Write sql ddl statements to create tables in oracle

Assignment Help Database Management System
Reference no: EM131481586

Question 1:

The diagram below (DB Setup ERD.pdf ) is an ERD for an order entry database for a company. A customer orders products through company employee.

1065_image.jpg

Study the ERD and answer the following questions:

I. Identify all relationships and specify cardinality and business rules. For example: 1:M between Customer and Orders: a customer can place many orders; an order will be placed by one and only one customer.

II. For each entity, identify primary key and foreign key if any. For foreign key, also specify parent entity and matching attribute in parent entity.

III. Write SQL DDL statements to create tables in Oracle and also implement primary key, foreign key, and NOT NULL constraint. Include all columns listed with the correct data type. This step is important as in Question 2 you will run INSERT statements to populate the tables you created and then write SELECT statement to query those tables.

IV. Write SQL statement for the following scenario:

a. Add a new customer John Smith with custono 1 and custzip 23456.

b. Save changes permanently.

c. Changer customer John Smith zip from 23456 to 20001.

d. Cancel the change made in step c, restore data to its original status prior to step c.

e. Delete customer John Smith.

f. Save changes permanently.

For SQL code, submit both source statements and results of running your statements.

Question 2:

Continue Question 1 above. It is important for you to create those tables with the exact table/column name and exact column data type/length as shown in the ERD.

Run the DB Setup.sql script attached and then respond the following SQL problems:

Create SQL statements for the following scenarios. Your response should include SQL statement, output and any other assumptions you have made to arrive at the solution. Please provide a single SQL query for each problem.

a. For Seattle, WA customers compute the average amount of their orders and the number of orders placed. The result should include the customer number, customer last name, average order amount and the number of orders placed. Show results in the order of average order amount from high to low.

b. For Seattle, WA customers compute the number of unique products ordered. If a product is purchased on multiple orders, it should be counted only one time. The result should include customer number, customer last name and the number of unique products ordered. Show results in the order of customer's last name.

c. For each employee with a commission less than 0.05, compute the number of orders taken and the average product total quantity per order. The results should include the employee number, employee last name, number of orders taken and the average product total quantity per order. Show results in the order of number of orders taken from low to high.

d. For each Connex product compute the number of unique customers who ordered the product in Jan 2007. The results should include the product number, product name and the number of unique customers. Show results in the order of product name.

Reference no: EM131481586

Questions Cloud

How is the discount rate different from federal funds rate : What is the current required reserve ratio? What would happen to the money supply if the Fed decreased the ratio?
Define quantitative easing : How is it different from standard open market operations?
What is largest amount by which money supply can increase : Suppose that you take $150 in currency out of your pocket and deposit it in your checking account. Assuming a required reserve ratio of 10%.
Write changes to balance sheet for each of given scenarios : Using a required reserve ratio of 10% and assuming that the bank keeps no excess reserves, write the changes to the balance sheet for each of the following.
Write sql ddl statements to create tables in oracle : Write SQL DDL statements to create tables in Oracle and also implement primary key, foreign key, and NOT NULL constraint.
Which scenarios produces larger increase in money supply : Using a required reserve ratio of 10% and assuming that banks keep no excess reserves, which of the following scenarios produces a larger increase in the money.
Discuss potential enforcement problems in environmental law : Discuss potential enforcement problems in environmental law. Briefly discuss international forums for Justice and their significance.
Analyze what went wrong that caused the system : Analyze what went wrong that caused the system of internal control to fail, and what could have been done differently to prevent the problems.
What is value of government securities the fed must purchase : Using a required reserve ratio of 10% and assuming that banks keep no excess reserves, what is the value of government securities the Fed must purchase.

Reviews

Write a Review

Database Management System Questions & Answers

  Knowledge and data warehousing

Design a dimensional model for analysing Purchases for Adventure Works Cycles and implement it as cubes using SQL Server Analysis Services. The AdventureWorks OLTP sample database is the data source for you BI analysis.

  Design a database schema

Design a Database schema

  Entity-relationship diagram

Create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices and concepts.

  Implement a database of courses and students for a school

Implement a database of courses and students for a school.

  Prepare the e-r diagram for the movie database

Energy in the home, personal energy use and home energy efficiency and Efficient use of ‘waste' heat and renewable heat sources

  Design relation schemas for the entire database

Design relation schemas for the entire database.

  Prepare the relational schema for database

Prepare the relational schema for database

  Data modeling and normalization

Data Modeling and Normalization

  Use cases perform a requirements analysis for the case study

Use Cases Perform a requirements analysis for the Case Study

  Knowledge and data warehousing

Knowledge and Data Warehousing

  Stack and queue data structure

Identify and explain the differences between a stack and a queue data structure

  Practice on topic of normalization

Practice on topic of Normalization

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