Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.51 KB | None | 0 0
  1. insert account details only
  2.  
  3. INSERT INTO account_tbl(passengerTitle_ID, account_Forename, account_Surname, account_Email, account_AddressLine1, account_AddressLine2, account_Mobile, easyjetPlus_Number, preferredDepart_1, preferredDepart_2, preferredDepart_3, contact_Opt)
  4. VALUES ('1', 'Erin', 'Reid', 'erinr123@gmail.com', '1 Main Street', '', '2826', '125548', '1', '6', '3', '1');
  5.  
  6. ----------------------------------------------
  7. insert account id details and then account security
  8.  
  9.  
  10. INSERT INTO account_tbl(passengerTitle_ID, account_Forename, account_Surname, account_Email, account_AddressLine1, account_AddressLine2, account_Mobile, easyjetPlus_Number, preferredDepart_1, preferredDepart_2, preferredDepart_3, contact_Opt)
  11. VALUES ('4', 'Steven', 'McBride', 'steven@gmail.com', '964 John Street', '', '159632', '12748', '1', '6', '3', '1');
  12.  
  13. INSERT INTO accountSecurity_ID (account_Password, account_Answer, account_Question, account_ID)
  14. VALUES ('password', 'dog', 'what is your favourite animal', '7');
  15.  
  16.  
  17. ------------------------------------------------
  18. 1. insert account and then insert security for that new account
  19.  
  20. INSERT INTO account_tbl(passengerTitle_ID, account_Forename, account_Surname, account_Email, account_AddressLine1, account_AddressLine2, account_Mobile, easyjetPlus_Number, preferredDepart_1, preferredDepart_2, preferredDepart_3, contact_Opt)
  21. VALUES ('4', 'Charlie', 'McBride', 'steven@gmail.com', '964 John Street', '', '159632', '12748', '1', '6', '3', '1');
  22.  
  23. INSERT INTO accountSecurity_ID (account_ID, account_Password, account_Answer, account_Question)
  24. SELECT account_ID, 'password', 'dog', 'what is your favourite animal'
  25. FROM account_tbl WHERE account_Forename = 'Charlie';
  26.  
  27.  
  28. -----------------------------------------------
  29.  
  30. 2. insert account and then insert security for that new account and then insert a booking for that account
  31.  
  32. INSERT INTO account_tbl(passengerTitle_ID, account_Forename, account_Surname, account_Email, account_AddressLine1, account_AddressLine2, account_Mobile, easyjetPlus_Number, preferredDepart_1, preferredDepart_2, preferredDepart_3, contact_Opt)
  33. VALUES ('1', 'Sarah', 'Sholdis', 'sarah@hotmail.com', '1 Seahill Road', '', '7887456985', '55555', '1', '6', '3', '1');
  34.  
  35. INSERT INTO accountSecurity_ID(account_ID, account_Password, account_Answer, account_Question)
  36. SELECT account_ID, 'password', 'lennon', 'what is your mothers maiden name'
  37. FROM account_tbl WHERE account_Forename = 'Sarah';
  38.  
  39. INSERT INTO booking_tbl(account_ID, booking_date, all_CheckedIn, flight_ID_DEPART, flight_ID_RETURN, total_Bill)
  40. SELECT account_ID, '05/12/2017', '0', '2', '1', ''
  41. FROM account_tbl WHERE account_Forename = 'Sarah';
  42.  
  43.  
  44. -------------------------------------------------
  45.  
  46. 3. booking passengers onto a flight
  47.  
  48. INSERT INTO booking_tbl(account_ID, booking_date, all_CheckedIn, flight_ID_DEPART, flight_ID_RETURN, total_Bill)
  49. SELECT account_ID, '05/12/2017', '1', '1', '2', '0'
  50. FROM account_tbl WHERE account_Forename = 'Louise';
  51.  
  52. INSERT INTO passenger_tbl(passengerAge_ID, booking_ID, passengerType_ID, passengerTitle_ID, passenger_Forename, passenger_Surname, checked_In)
  53. SELECT passengerAge_ID, booking_ID, passengerType_ID, passengerTitle_ID, 'Anthony', 'Flynn', '0'
  54. FROM passengerAge_tbl, booking_tbl, passengerType_tbl, passengerTitle_tbl WHERE passenger_Age = '15' AND booking_ID = 6 AND passengerType_ID = 2 AND passengerTitle_ID = 4;
  55.  
  56. ------------------------------------------------
  57.  
  58. 4. add two bags for an existing passenger and then add the values of them together to get the cost
  59.  
  60. INSERT INTO bags_tbl(passenger_ID, holdBag_ID, otherBag_ID)
  61. SELECT passenger_ID, '3', '4'
  62. FROM passenger_tbl WHERE passenger_Forename = 'Anthony';
  63.  
  64. SELECT holdBag_tbl.holdBag_Price, otherBag_tbl.otherBag_Price, (holdBag_Price + otherBag_Price) AS TotalBagPrice
  65. FROM bags_tbl INNER JOIN
  66. holdBag_tbl ON bags_tbl.holdBag_ID = holdBag_tbl.holdBag_ID INNER JOIN
  67. otherBag_tbl ON bags_tbl.otherBag_ID = otherBag_tbl.otherBag_ID
  68. WHERE passenger_ID = 14
  69.  
  70.  
  71. ------------------------------------------------
  72.  
  73. SELECT route_tbl.route_Price, booking_tbl.booking_ID
  74. FROM booking_tbl INNER JOIN
  75. flight_tbl ON booking_tbl.flight_ID_RETURN = flight_tbl.flight_ID INNER JOIN
  76. flightRoute_ID ON flight_tbl.flight_ID = flightRoute_ID.route_ID INNER JOIN
  77. route_tbl ON flightRoute_ID.route_ID = route_tbl.route_ID
  78. WHERE booking_ID = 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement