I need 8 more queries on this database.Below there is question and their respective tables and sample queries.I need 8 more queries other than present below  Create a database named Amazon using the attributes.Create individual tables based on below attributes Customers Products Product_types Orders Customer payment methods Tacking Order status Shipments Invoice create different tables and mention their primary keys and foreign keys Describe atleast 6 business rules create Entity Relationship Diagram.The ERD should be in Crow's Foot Model.It should include all the appropriate entities,connectivity,cardinalities and relationship participation. 4 sample queries in plain English and their SQL SELECT statements check_circle Expert Answer thumb_up   thumb_down Step 1 BUSINESS RULES   One customer can have one or more orders. One order belongs to only one customer. One customer has only one payment method. One payment methods can belong to one or more customers. One order contains only one product. One product be ordered one or more times. One order generates only one invoice. One invoice belongs to only one order. One order can have only one shipment. One shipment belongs to only one order. One product has only one product type. One or more products can have same product type.   Step 2 The Entity Relationship Diagram in Crow's Foot Model is as shown.   ERD   Step 3 TABLES CUSTOMERS ( custID, fullName, Address, City, State, Email, Phone, payID ) PRIMARY KEY - custID FOREIGN KEY - payID CUST_PAY_METHOD ( payID, pay_method, cardNum, expiryDate ) PRIMARY KEY - payID PRODUCTS ( prodID, name, description, typeID, price, qtyOnHand ) PRIMARY KEY - prodID FOREIGN KEY - typeID PRODUCT_TYPE ( typeID, description ) PRIMARY KEY - typeID ORDERS ( orderID, custID, orderDate, orderQty ) PRIMARY KEY - orderID FOREIGN KEY - custID ORDER_STATUS ( statusID, status ) PRIMARY KEY - statusID INVOICE ( invID, orderID, subTotal, discount, total ) PRIMARY KEY - invID FOREIGN KEY - orderID SHIPMENT ( shipID, orderID, shipDate, shipCharges, estRecdDate ) PRIMARY KEY - shipID FOREIGN KEY - orderID SHIPMENT_STATUS ( statusID, shipID, shipStatus ) PRIMARY KEY - statusID FOREIGN KEY - shipID Step 4 QUERIES 1. List all the orders which have been shipped. SELECT orderID FROM ORDERS JOIN ORDER_STATUS ON ORDERS.orderID = ORDER_STATUS.orderID WHERE status = "Shipped" ;     2. List all the orders that have been delivered. SELECT orderID FROM ORDERS JOIN SHIPMENT ON ORDERS.orderID = SHIPMENT.orderID JOIN SHIPMENT_STATUS ON SHIPMENT.shipID = SHIPMENT_STATUS.shipID WHERE shipStatus = "Delivered" ;     3. List all the payment methods used by the customers. SELECT pay_method FROM CUST_PAY_METHOD ;     4. List all the products and their types sorted by types. SELECT name, type FROM PRODUCTS JOIN PRODUCT_TYPE ON PRODUCTS.typeID = PRODUCT_TYPE.typeID GROUP BY type ORDER BY type ;

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter13: Views
Section: Chapter Questions
Problem 2MC
icon
Related questions
Question

I need 8 more queries on this database.Below there is question and their respective tables and sample queries.I need 8 more queries other than present below

 Create a database named Amazon using the attributes.Create individual tables based on below attributes

  1. Customers
  2. Products
  3. Product_types
  4. Orders
  5. Customer payment methods
  6. Tacking
  7. Order status
  8. Shipments
  9. Invoice

create different tables and mention their primary keys and foreign keys

Describe atleast 6 business rules

create Entity Relationship Diagram.The ERD should be in Crow's Foot Model.It should include all the appropriate entities,connectivity,cardinalities and relationship participation.

4 sample queries in plain English and their SQL SELECT statements

check_circle

Expert Answer

thumb_up
 
thumb_down
Step 1

BUSINESS RULES

 

One customer can have one or more orders. One order belongs to only one customer.

One customer has only one payment method. One payment methods can belong to one or more customers.

One order contains only one product. One product be ordered one or more times.

One order generates only one invoice. One invoice belongs to only one order.

One order can have only one shipment. One shipment belongs to only one order.

One product has only one product type. One or more products can have same product type.

 

Step 2

The Entity Relationship Diagram in Crow's Foot Model is as shown.

 

ERD

 

Step 3

TABLES

CUSTOMERS ( custID, fullName, Address, City, State, Email, Phone, payID )

PRIMARY KEY - custID

FOREIGN KEY - payID

CUST_PAY_METHOD ( payID, pay_method, cardNum, expiryDate )

PRIMARY KEY - payID

PRODUCTS ( prodID, name, description, typeID, price, qtyOnHand )

PRIMARY KEY - prodID

FOREIGN KEY - typeID

PRODUCT_TYPE ( typeID, description )

PRIMARY KEY - typeID

ORDERS ( orderID, custID, orderDate, orderQty )

PRIMARY KEY - orderID

FOREIGN KEY - custID

ORDER_STATUS ( statusID, status )

PRIMARY KEY - statusID

INVOICE ( invID, orderID, subTotal, discount, total )

PRIMARY KEY - invID

FOREIGN KEY - orderID

SHIPMENT ( shipID, orderID, shipDate, shipCharges, estRecdDate )

PRIMARY KEY - shipID

FOREIGN KEY - orderID

SHIPMENT_STATUS ( statusID, shipID, shipStatus )

PRIMARY KEY - statusID

FOREIGN KEY - shipID

Step 4

QUERIES

1. List all the orders which have been shipped.

SELECT orderID

FROM ORDERS JOIN ORDER_STATUS ON ORDERS.orderID = ORDER_STATUS.orderID

WHERE status = "Shipped" ;

 

 

2. List all the orders that have been delivered.

SELECT orderID

FROM ORDERS JOIN SHIPMENT ON ORDERS.orderID = SHIPMENT.orderID

JOIN SHIPMENT_STATUS ON SHIPMENT.shipID = SHIPMENT_STATUS.shipID

WHERE shipStatus = "Delivered" ;

 

 

3. List all the payment methods used by the customers.

SELECT pay_method

FROM CUST_PAY_METHOD ;

 

 

4. List all the products and their types sorted by types.

SELECT name, type

FROM PRODUCTS JOIN PRODUCT_TYPE ON PRODUCTS.typeID = PRODUCT_TYPE.typeID

GROUP BY type

ORDER BY type ;

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
Fundamentals of Information Systems
Fundamentals of Information Systems
Computer Science
ISBN:
9781305082168
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning
Fundamentals of Information Systems
Fundamentals of Information Systems
Computer Science
ISBN:
9781337097536
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning