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

  Wallsherpool sixth - theatre company

A report that shows the characters that still need actors for the current performance and storing the student details if all requirements are met, providing a suitable message for Vicky

  Converting user form into 1nf and 2nf

Complete database exercise by converting user form located the evaluation procedures section of the syllabus into 1NF and 2NF.

  Database management challenge than relational database

What is it about a 200 MB video or audio file which makes it so much more of database management challenge than relational database the same size?

  Write down advantage in storing metadata in tables

What is meant by a Metadata? How does this term pertain to a database? Write down advantage is there in storing metadata in tables?

  Optimistic concurrency control sets few locks on the data

Optimistic concurrency control sets few locks on the data in the database, lowering the isolation level that you use in an application. This allows more applications to run concurrently and potentially increases the throughput of the applications. Th..

  Advantages and inconveniences of new relational scheme

Compare activity (quite theoretical) of the disk (in number of bytes) required for each of both relational. Write down the advantages and inconveniences of new relational scheme.

  Create an er diagram using the set of requirements

Create an ER diagram using the set of requirements provided for Oxford City Council's bicycle sharing scheme and identify the minimal set of functional dependencies and all candidate keys for the relation R

  How many records are returned using minus operator

Customers Dunne an Olowski are included in the CUSTOMER table also in CUSTOMER_2 table. Explain How many records are returned when using the MINUS operator?

  Print to screen the ''below average''

Print to screen the 'below average' if minimum unit_cost is 10 for the same product (use sh.costs table)

  Description of the relationship represented by scatterplot

Produce a scatterplot of Rent vs. Size (square meters of the apartment) for the rental data in rent.

  Difference between obsolescent and redundant stocks

Difference between obsolescent and redundant stocks

  Timetabling system - write an sql function

With the new UNSW timetabling system, the LIC of each course is required to specify what facilities they require in their classrooms as one of the inputs to the timetabling process. Write an SQL function to provide a list of rooms that contain a g..

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