Following tables support the database of a shopping store. The schema contains four tables i.e. Customer, Product, Order and Order Product. Table details including attributes, primary keys (underline) and foreign keys (bold) are also shown below: CUSTOMER(CustID, CustName, CustEmail, CustPhone, CustCNIC) PRODUCT(ProdID, ProdName, ProdPrice) ORDER(OrderID, OrderDate, OrderPrice, CustID) ORDER_PRODUCT(OPID, ProdID, OrderID) i. Write SQL queries to create all above mentioned four tables in SQL. Must take care of correct data type and constraints (primary key, foreign key, not null etc.) where necessary. ii. Write a SQL query to get all customers’ data who use “yahoo” email.
Following tables support the
Customer, Product, Order and Order Product. Table details including attributes, primary keys
(underline) and foreign keys (bold) are also shown below:
CUSTOMER(CustID, CustName, CustEmail, CustPhone, CustCNIC)
PRODUCT(ProdID, ProdName, ProdPrice)
ORDER(OrderID, OrderDate, OrderPrice, CustID)
ORDER_PRODUCT(OPID, ProdID, OrderID)
i. Write SQL queries to create all above mentioned four tables in SQL. Must take care of correct data type and constraints (primary key, foreign key, not null etc.) where necessary.
ii. Write a SQL query to get all customers’ data who use “yahoo” email.
iii. Write a SQL query to show all product names that are in price range of 500 – 1500 (both inclusive) in descending order.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps