Write the sql ddl to create the database

Assignment Help PL-SQL Programming
Reference no: EM13316080

Part A

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

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

1218_table.png

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

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: EM13316080

Questions Cloud

Discuss similarities and differences in the roles economics : Discuss similarities and differences in the roles economics play in as policy advisors and scientists. How would advice offered to policy makers differ depending on which role an economist assumes?
Would the company profits necessarily increase : Suppose that the Live-Long-and-Prosper Health Insurance Company charges $5000 annually for a family insurance policy. The company’s president suggests that the company raise the annual price to $6000 to increase its profits
In the new orleans metropolitan area in august : In the New Orleans metropolitan area in August 2005, the labor force was 634,512 and 35,222 people were unemployed. In September 2005 following Hurricane Katrina
Explain the issues and concerns of flight deck human-machine : Explain the issues and concerns of Flight Deck Human-Machine Interface. Provide both the positives and possible hazards to this interface.
Write the sql ddl to create the database : Write a command that will remove the Jones that lives in Orange from the Customer table .Write the SQL DDL to create the database that contains each of the relations shown in the above ERD.
What is the velocity of the satellite : A 218.7 kg satellite is in a circular orbit of 26,273 miles (42,300,000 m) in radius. What is the velocity (speed) of the satellite
Practical scada systems for industry : IDC Technologies. Practical SCADA Systems for Industry - As its name suggests, SCADA has been around for as long as process control and data acquisition existed.
How much work was done on the aircraft : An aircraft weighing 849 N is accelerated at 7 m/s/s for 13 seconds, at which time the aircraft launches. How much work was done on the aircraft
Why does the aggregate demand curve slope down and aggregate : Why does the aggregate demand curve slope down and aggregate supply curve slope upwards? Keep in mind the aggregate demand curve represents the total value of all goods and services demanded in the economy at various prices and aggregate

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  Create a database model

Create a database model and Submit the table creation statements for the Database Model.

  Write a perl subroutine for temperature conversion

Write a perl subroutine for temperature conversion named 'convert_temp'. It should be able to handle both Fahrenheit to Celsius conversions as well as Celsius to Fahrenheit conversions.

  Write pl-sql block which displays last name

Write PL/SQL block which displays last name and salary of following people. Each of these can be done separately as PL/SQL, first to test and get output lines

  Script below to create an updateable

Use the script below to create an updateable view named balance_due_view. Then, create and test an INSTEAD OF trigger named invoices_instead_of_insert that lets the user update the columns in the view by directly updating the Invoices table.

  Write a program in towers of hanoi

How to write a program in towers of hanoi using pl/sql language

  Provide sql statements to create the database

Provide SQL statements to create the database and populate it with sample data (at least four rows per table).

  F does not logically imply

Given R = (J,K,L ) and the set F of FDs J -> K and L -> K , show that F does NOT logically

  Write statement which creates table named part

Write the statement which creates table named Part, with Id field as an int idendity PK, a SupplierId int field, a Description string field of size 25, a Count int field, a Class string field

  Perform the tasks below by using the correct sql statements

Create a view so that supplier 'ASP' can only see his information from the l_foods table.  Call this view_l_foods_ASP.  Show columns supplier_id, product_code, menu_item, description, and price in your view.

  Write functions to perform the following tasks

Write a function, called ‘binarySearch', implements a binary search. This function should take three parameters.

  Select statement to return one row

Write a SELECT statement that returns one row for each general ledger account number which contains three columns.

  Trigger named products_insert

Create a trigger named Products_INSERT that inserts the current date for the DateAdded column of the Products table if the value for that column is null. Test this trigger with an appropriate INSERT statement.

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