Advertisement
Nickpips

Untitled

Oct 27th, 2015
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. Customers
  2. =========
  3. CID (pk)
  4. fname
  5. lname
  6. ---------
  7.  
  8. Addresses
  9. =========
  10. AID (pk)
  11. CID (fk)
  12. address
  13. ---------
  14.  
  15. Orders
  16. =========
  17. OID (pk)
  18. PID (fk)
  19. AID (fk)
  20. SID (fk)
  21. date
  22. s_cost
  23. price
  24. total
  25. ---------
  26.  
  27. S_Options
  28. =========
  29. SID (pk)
  30. name
  31. ---------
  32.  
  33. Products
  34. =========
  35. PID (pk)
  36. name
  37. price
  38. ---------
  39.  
  40. 1) SELECT CID,fname,lname FROM Customers;
  41. 2) SELECT address FROM Addresses WHERE CID=64;
  42. 3)
  43. a.
  44. SELECT fname,lname,address FROM Orders
  45. INNER JOIN Addresses ON Orders.AID=Addresses.AID
  46. INNER JOIN Customers ON Addresses.CID=Customers.CID
  47. WHERE Orders.OID=64;
  48. b.
  49. SELECT fname,lname,address FROM Orders
  50. INNER JOIN Addresses ON Orders.AID=Addresses.AID
  51. INNER JOIN Customers ON Addresses.CID=Customers.CID
  52. WHERE Orders.OID=64;
  53. c.
  54. SELECT name,total FROM Orders
  55. INNER JOIN Addresses ON Orders.AID=Addresses.AID
  56. INNER JOIN Customers ON Addresses.CID=Customers.CID
  57. WHERE Orders.OID=64;
  58. 4)
  59. 5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement