Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Customers
- =========
- CID (pk)
- fname
- lname
- ---------
- Addresses
- =========
- AID (pk)
- CID (fk)
- address
- ---------
- Orders
- =========
- OID (pk)
- AID (fk)
- SID (fk)
- date
- s_cost
- price
- total
- ---------
- S_Options
- =========
- SID (pk)
- name
- cost
- ---------
- OrderItems
- =========
- OIID (pk)
- OID (fk)
- PID (fk)
- ---------
- Products
- =========
- PID (pk)
- name
- price
- ---------
- 1) SELECT CID,fname,lname FROM Customers;
- 2) SELECT address FROM Addresses WHERE CID=64;
- 3)
- a. SELECT *,fname,lname,address FROM Orders
- INNER JOIN Addresses ON Orders.AID=Addresses.AID
- INNER JOIN Customers ON Addresses.CID=Customers.CID
- WHERE Orders.OID=64;
- b. SELECT *,name,OrderItems.price FROM Orders
- INNER JOIN OrderItems ON Orders.OID=OrderItems.OID
- WHERE Orders.OID=64;
- c. SELECT *,name,cost FROM Orders
- INNER JOIN S_Options ON Orders.SID=S_Options.SID
- WHERE Orders.OID=64;
- 4)
- SELECT * FROM Orders
- INNER JOIN Addresses ON Orders.AID=Addresses.AID
- INNER JOIN Customers ON Addresses.CID=Customers.CID
- WHERE Customers.CID=64;
- 5) SELECT * FROM OrderItems WHERE OID=64;
- 6) SELECT * FROM OrderItems;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement