120 likes | 221 Views
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. $10. $30. $50. Kaimuki Kokua Theater. For reservations call: (808) 332-4525 and ask for Cathy. Reservation System. The ticket agency for the Kaimuki Kokua Theater has a Web-based system that allow users to perform the following queries:
E N D
1 2 3 4 5 6 7 8 9 10 $10 $30 $50 Kaimuki Kokua Theater For reservations call: (808) 332-4525 and ask for Cathy
Reservation System • The ticket agency for the Kaimuki Kokua Theater has a Web-based system that allow users to perform the following queries: • Display all seats in the theater • Display seats by price • Display available seats, given a particular price • Display reserved seats, including customer name • Given a seat, cancel a reservation
Design of Reservation DB • Customers (cusID, cusFName, cusLName, cusPhone) • Seats (seatID, seatReserved) • Prices (priceID, priceValue) • Value of price is separated from the Seats table,so that when prices are changed, only Prices table needs to be modified.
Customers cusIDcuslNamecusfNamecusPhone Seats seatIDpriceIDcusIDseatReserved Prices priceID|priceValue 1 1 M M Tables
Create DB • Create Reservation DB, using Access. • Link table, using relationship window. • Populate tables with sample data.
SQL for “Show All Seats” • SELECT Seats.seatID, Prices.priceValue, Seats.seatReserved FROM Seats, Prices WHERE Seats.priceID = prices.priceIDORDER BY Seats.seatID
Your Turn • Show all $10 seats • Show all available seats • Show all $10 seats that are available • Show all $10 or $30 seats that are available • Show all seats that are reserved (including their seadID, prices, and customers) • Make a reservation for Tom Jones for a $60 seat. • Cancel reservation for seat No. 3
ASP to show all seats • Seats.asp
Result of ASP Processing • HTML Page returned by seats.asp
Answers to SQL Questions • SELECT Seats.seatid, Prices.priceValueFROM Seats, PricesWHERE Seats.priceID=Prices.priceIDAND Prices.priceValue=10 • SELECT Seats.seatID, Prices.priceValueFROM Seats, PricesWHERE Seats.priceID=Prices.priceIDAND Seats.seatReserved=false • SELECT Seats.seatID, Prices.priceValueFROM Seats, PricesWHERE Seats.priceID=Prices.priceIDAND Seats.seatReserved=falseAND Prices.priceValue=10
Answers to SQL Questions • SELECT Seats.seatID, Prices.priceValueFROM Seats, PricesWHERE Seats.priceID=Prices.priceIDAND Seats.seatReserved=falseAND (Prices.priceValue=10 OR Prices.priceValue=20) • SELECT Seats.seatID, Prices.priceValue, Customers.cusLNameFROM Seats, Prices, CustoemersWHERE Seats.priceID=Prices.priceIDAND Customers.cusID=Seats.seatIDAND Seats.seatReserved=true • UPDATE SeatsSET seatReserfed=false, cusID=NullWHERE seatID=3