Write the sql ddl to create the database

Assignment Help Database Management System
Reference no: EM13185723

Part A

Use the Prime Minister database (Prime_Minister_2013.sql) available from the Interact site. Answer the following queries using that database.

You are required to submit:

1. The appropriate SQL statements, which should be copied from your SQL code in MySQL, and pasted into your submission file; and

2. Screenshots of the resultant tables which are to be pasted into your assignment file immediately after the SQL code. Typing or manually drawing the results is NOT acceptable.

Write SQL SELECT statements to retrieve the following information from the Prime Minister database.

1. List the name, year commenced service as Prime Minister, party, state represented and the name of the Deputy Prime Minister for each Prime Minister that served for less than 3 years. Order by the year they commenced service as Prime Minister in descending order

2. List the name, party, recreation(s), name of their spouse and number of children of each Prime Minister of a Labor government who had four or more children and enjoyed outdoor sports.

3. List the name, the year that they commenced service as Prime Minister, the party they led and the year in which they left office of each Prime Minister of a Labor government. Order by the year they commenced service and the Prime Minister's name.

4. Did any Deputy Prime Minister(s) subsequently become Prime Minister? List the Deputy Prime Ministers name, the year that he/she commenced as Deputy Prime Minister, the year he/she commenced as Prime Minister and the party that they led. Order the list by name, year commencing as Prime Minister and Party in descending order.

Part B

The following questions are based on the Book Seller ERD as shown below. 

2187_Write and execute SQL definition commands.png

Tasks:

1. Write the SQL DDL to create the database that contains each of the relations shown in the above ERD. You will need to provide:

a. Your DDL code for each table that you create;

b. A screenshot showing each table that is created.

Notes:

- Use appropriate data types for each of the attributes;
- Use correct integrity constraints for each of the tables you create;
- You are to use the primary keys identified in the ERD;
- You are to identify and implement appropriate primary keys in the associative tables;
- You may need to create additional attributes in associative tables;
- Your SQL DDL code needs to be in the correct format for your RDBMS.

2. Before any row can be entered into the BOOKS table, the Author_ID must already exist in the AUTHOR table, why?

3. Write and execute SQL definition commands for each of the following queries:

a. Add the attributes Email, Comments and Send Newsletter to the CUSTOMERS table. Give those attributes an appropriate size and data type.

b. Change the attribute BOOK_CATEGORY_DESCRIPTION from 15 characters to 50 characters. 

4. Write and execute SQL commands for the following:

a. Add the following customers  to the Customer table.

12345, Jones, George, 123 Bentinck St, Bathurst, NSW, 2795, 0213455678
23456, Jones, Pauline, 48 Summer St, Orange, NSW, 2800, 0223456789
34567, Wilson, Paul, 23 Long St Blayney, NSW, 2799, 0298765432

b. Write a command that will remove the Jones that lives in Orange from the Customer table.

You are required to submit:

1. The appropriate SQL commands, which should be copied from your source code in MySQL, and pasted into your submission file; and

2. The resultant tables, which must be screenshots to show the change due to the execution of commands.

Typing or manually drawing the results are NOT acceptable.

Rationale

This assignment has been designed to test students in the use of the 4th Generation language SQL.

Reference no: EM13185723

Questions Cloud

Explain volumetric glassware : Compare volumetric glassware (volumetric flasks, pipets, burets) with other routine glassware (Erlenmeyer flasks, graduate cylinders, beakers) by sorting the qualities or properties into the correct bins.
Estimate the interest rate the bank : A bank estimated the interest on the $100 debt from 1835 to 1995 to be $420 million. Find/estimate the interest rate the bank was using for 160 years, assuming interest is compounded annually.
Determine the economic service life and corresponding aw : A new gear grinding machine for composite materials has a first cost of P=$100,000 and can be used for a maximum of 3 years. Its salvage value is estimated by the relation S=P(0.85)n, where n is the number of years after purchase. The operating co..
Find the distance that the car will travel after five hours : a car is traveling at a cost velocity after two hours the car has traveled 110 miles after four hours the car has traveled 220 miles assuming a linear equation fits this situation find the distance that the car will travel after five hours.
Write the sql ddl to create the database : The appropriate SQL commands, which should be copied from your source code in MySQL, and pasted into your submission file; and The resultant tables, which must be screenshots to show the change due to the execution of commands
Explain a component of a protein called serine : A component of a protein called serine has the following percent composition by mass: 34.95% C, 6.844% H, 46.56% O, and 13.59% N. It also has an approximate molar mass of 100 g/mol.
What is the ytd stock market return : Compute the growth rate of the dividend, g. (You can either compute the ROE*plowback ratio or compute the annual growth rate of dividends) e) Based on this information, what should the price of the stock be today using the constant-growth dividend d..
Compute the number of grams of iron : calculate the number of grams of iron and the number of grams of carbon dioxide formed
What is organism''s actions as result to sensory and neural : What is the organism's actions as a result to sensory,neural,and hormonal factors in response to changes in external or internal conditions?

Reviews

Write a Review

Database Management System Questions & Answers

  Convert table to equivalent collection of tables

determine the functional dependencies that exist in the following table. After determining the functional dependencies, convert this table to an equivalent collection of tables.

  Yrace history of the development of databases

In 500 words or less, trace the history of the development of databases beginning with pre-computer days to the present.

  Access values through queries to databases

However, the only way you can access values is through queries to the databases. In single query, you can specify value k to one of two databases.

  Recognize level within a database system

Recognize level within a database system (user, programmer of application software, and designer of the DBMS software) at which each of the following concerns or activities occur.

  Write problems and issues related with internet databases

Write down some of problems and issues related with internet databases? Consider security, performance, architecture issues.

  Implement in access database using check and unique

These comprise NOT NULL, CHECK, UNIQUE, REFERENTIAL INTEGRITY, and PRIMARY KEY constraints. Are these constraints which we are talking about easy to implement in Access Database?

  Explain what is the purpose of database

Explain what is the purpose of Database? The purpose of a database is to store information about certain types of objects. Give an example of two related TABLES.

  Develop a new information system

MGMT321 Group Project :  You were hired as an analyst to develop a new information system to automate the payroll transactions in a mid-size organization. The proposed system will contain employees’ data and interface with the organization’s General ..

  Explain database models-hierarchical and relational

Explain each of three database models, hierarchical, relational, and object-oriented, and provide specific referenced example of each of these model types implemented in a functioning database

  Determine the functional dependencies

Using your knowledge of the college environment, determine the functional dependencies that exist in the following?

  Select suitable statistical measure to compare consistency

Select an appropriate statistical measure to compare consistency of sales. Make the calculations and write a report. In your calculations, include the mean sales for each salesperson.

  Demodulator circuits and amplitude modulator

Explain how much the modulating signal power is required to generate 100 percent modulation? What is the approximate center frequency of filter required to pass the lower sideband?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd