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

  An er diagram for the system

An ER diagram for the system. Show all entities, relationships, cardinalities and optionalities. Also, include all intersection entities. You must use the Finkelstein methodology as per the study book and tutorials.

  Construct a query that will show the number of days

Imagine that you work for a finance industry-based organization. Your organization is looking to submit its database design documentation to an evaluation team in order to meet Sarbanes-Oxley (SOX) compliance.

  Create and populate the database system using sql server

Global Car Club (GCC) is a small individually owned club which loans cars to its members. GCC first formed in 2009; has over more than 100 good mixes of members and counting.

  Pretend that you are on the boards

Pretend that you are on the boards of the American National Standards Institute (ANSI) and the International Organization for Standards (ISO), two of the organizations who standardized SQL

  Write a iterative function that returns the summation

Write and test functions that return summation of all the numbers (items) in the list. Write a recursive function that returns the summation of all the numbers in the list.

  Add three rows to the downloads

Add three rows to the Downloads table: one row for user 1 and product 2; one for user 2 and product 1; and one for user 2 and product 2. Use the GETDATE function to insert the current date and time into the DownloadDate column.

  Run the lab_03_01.sql script

Run the lab_03_01.sql script in the attached file to create the SAL_HISTORY table. Display the structure of the SAL_HISTORY table.

  Create a view named productsummary

Create a view named ProductSummary that uses the view you created in exercise 4. This view should return some summary information about each product.

  Prior to the adoption of sql as a standard

Prior to the adoption of SQL as a standard by the American National Standards Institute (ANSI), each database management system (DBMS) had its own unique command language and syntax. SQL was adopted as an ANSI standard in 1986. The International S..

  What is an sql injection attack

What is an SQL injection attack? Explain how it works, and what precautions must be taken to prevent SQL injection attacks.What are two advantages of encrypting data stored in the database?

  Write sql statement to add new record to part table

Write SQL statement which creates the stored procedure which adds new record to the Part table, and returns value of newly created PartID PK value in out parameter.

  Write queries in sql and relational algebra

Write given queries in SQL and relational algebra: Determine cities from which one can fly to Toronto with one change of planes, and using same type of the aircraft for both legs of trip.

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