wing 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.  iii. Write a SQL query to show all product names that are in price range of 500 – 1500 (both inclusive) in descending order.?

Database Systems: Design, Implementation, & Management
12th Edition
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Carlos Coronel, Steven Morris
Chapter8: Advanced Sql
Section: Chapter Questions
Problem 18RQ
icon
Related questions
Question

8.DSA_ AND ALGO DATABASE  MTT

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. 


iii. Write a SQL query to show all product names that are in price range of 500 – 1500 (both inclusive) in descending order.? 

 

 

Expert Solution
steps

Step by step

Solved in 3 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.
Recommended textbooks for you
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
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Fundamentals of Information Systems
Fundamentals of Information Systems
Computer Science
ISBN:
9781337097536
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning