Consider the tables CUSTOMER, ORDER and PRODUCT given below:
Table: CUSTOMER
CID |
CName |
Address |
Phone |
C01 |
Anil |
Delhi |
9876543210 |
C02 |
Bina |
Mumbai |
8765432109 |
C03 |
Chetan |
Kolkata |
7654321098 |
C04 |
Divya |
Chennai |
6543210987 |
C05 |
Esha |
Hyderabad |
5432109876 |
Table: ORDER
OID |
Date |
Amount |
CID |
PID |
O01 |
01-01-2020 |
5000 |
C01 |
P01 |
O02 |
02-02-2020 |
8000 |
C02 |
P02 |
O03 |
03-03-2020 |
3000 |
C03 |
P03 |
O04 |
04-04-2020 |
4000 |
C04 |
P04 |
O05 |
05-05-2020 |
6000 |
C05 |
P05 |
O06 |
06-06-2020 |
7000 |
C01 |
P06 |
O07 |
07-07-2020 |
9000 |
C02 |
P07 |
Table: PRODUCT
PID |
PName |
Category |
Price |
P01 |
Laptop |
Electronics |
50000 |
P02 |
Sofa |
Furniture |
20000 |
P03 |
Book |
Stationery |
500 |
P04 |
Mobile |
Electronics |
15000 |
P05 |
Table |
Furniture |
10000 |
P06 |
Printer |
Electronics |
10000 |
P07 |
Chair |
Furniture |
5000 |
Write SQL queries for the following:
(i) Display customer name and order date from the tables CUSTOMER and ORDER.
Answer:
Answer by student
SELECT CName, Date FROM CUSTOMER, ORDER WHERE CUSTOMER.CID = ORDER.CID;
Detailed answer by teachoo
The rest of the post is locked. Join Teachoo Black to see the full post.