$10

12
1 3 2 1 0 9 8 7 6 5 4 $10 $30 $50 Kaimuki Kokua Theater Kaimuki Kokua Theater For reservations call: (808) 332-4525 and ask for Cathy

description

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: - PowerPoint PPT Presentation

Transcript of $10

Page 1: $10

1 32 10987654

$10 $30 $50

Kaimuki Kokua Kaimuki Kokua TheaterTheater

For reservations call: (808) 332-4525 and ask for Cathy

Page 2: $10

Reservation SystemReservation System

• The ticket agency for the Kaimuki Kokua The ticket agency for the Kaimuki Kokua Theater has a Web-based system that Theater has a Web-based system that allow users to perform the following allow users to perform the following queries:queries:– Display all seats in the theaterDisplay all seats in the theater– Display seats by priceDisplay seats by price– Display available seats, given a particular Display available seats, given a particular

priceprice– Display reserved seats, including customer Display reserved seats, including customer

namename– Given a seat, cancel a reservationGiven a seat, cancel a reservation

Page 3: $10

Design of Reservation DBDesign of Reservation DB

• Customers (cusID, cusFName, Customers (cusID, cusFName, cusLName, cusPhone)cusLName, cusPhone)

• Seats (seatID, seatReserved)Seats (seatID, seatReserved)• Prices (priceID, priceValue)Prices (priceID, priceValue)

– Value of price is separated from the Value of price is separated from the Seats table,Seats table,so that when prices are changed, only so that when prices are changed, only Prices table Prices table needs to be modified.needs to be modified.

Page 4: $10

TablesTables

Customers

cusIDcuslNamecusfNamecusPhone

Seats

seatIDpriceIDcusIDseatReserved

Prices

priceID|priceValue

1

MM

1

Page 5: $10

Create DB Create DB • Create Reservation DB, using Access.Create Reservation DB, using Access.• Link table, using relationship window.Link table, using relationship window.• Populate tables with sample data.Populate tables with sample data.

Page 6: $10

Sample DataSample Data

Page 7: $10

SQL for “Show All SQL for “Show All Seats”Seats”

• SELECT Seats.seatID, SELECT Seats.seatID, Prices.priceValue, Prices.priceValue, Seats.seatReserved Seats.seatReserved FROM Seats, Prices FROM Seats, Prices WHERE Seats.priceID = WHERE Seats.priceID = prices.priceIDprices.priceIDORDER BY Seats.seatIDORDER BY Seats.seatID

Page 8: $10

Your TurnYour Turn1.1. Show all $10 seatsShow all $10 seats

2.2. Show all available seatsShow all available seats

3.3. Show all $10 seats that are availableShow all $10 seats that are available

4.4. Show all $10 or $30 seats that are availableShow all $10 or $30 seats that are available

5.5. Show all seats that are reserved (including Show all seats that are reserved (including their seadID, prices, and customers)their seadID, prices, and customers)

6.6. Make a reservation for Tom Jones for a $60 Make a reservation for Tom Jones for a $60 seat.seat.

7.7. Cancel reservation for seat No. 3Cancel reservation for seat No. 3

Page 9: $10

ASP to show all seatsASP to show all seats

• Seats.aspSeats.asp

Page 10: $10

Result of ASP ProcessingResult of ASP Processing

• HTML Page HTML Page returned by returned by seats.aspseats.asp

Page 11: $10

Answers to SQL Answers to SQL QuestionsQuestions

1.1. SELECT Seats.seatid, Prices.priceValueSELECT Seats.seatid, Prices.priceValueFROM Seats, PricesFROM Seats, PricesWHERE Seats.priceID=Prices.priceIDWHERE Seats.priceID=Prices.priceIDAND Prices.priceValue=10AND Prices.priceValue=10

2.2. SELECT Seats.seatID, Prices.priceValueSELECT Seats.seatID, Prices.priceValueFROM Seats, PricesFROM Seats, PricesWHERE Seats.priceID=Prices.priceIDWHERE Seats.priceID=Prices.priceIDAND Seats.seatReserved=falseAND Seats.seatReserved=false

3.3. SELECT Seats.seatID, Prices.priceValueSELECT Seats.seatID, Prices.priceValueFROM Seats, PricesFROM Seats, PricesWHERE Seats.priceID=Prices.priceIDWHERE Seats.priceID=Prices.priceIDAND Seats.seatReserved=falseAND Seats.seatReserved=falseAND Prices.priceValue=10AND Prices.priceValue=10

Page 12: $10

Answers to SQL Answers to SQL QuestionsQuestions

1.1. SELECT Seats.seatID, Prices.priceValueSELECT Seats.seatID, Prices.priceValueFROM Seats, PricesFROM Seats, PricesWHERE Seats.priceID=Prices.priceIDWHERE Seats.priceID=Prices.priceIDAND Seats.seatReserved=falseAND Seats.seatReserved=falseAND (Prices.priceValue=10 OR Prices.priceValue=20)AND (Prices.priceValue=10 OR Prices.priceValue=20)

2.2. SELECT Seats.seatID, Prices.priceValue, SELECT Seats.seatID, Prices.priceValue, Customers.cusLNameCustomers.cusLNameFROM Seats, Prices, CustoemersFROM Seats, Prices, CustoemersWHERE Seats.priceID=Prices.priceIDWHERE Seats.priceID=Prices.priceIDAND Customers.cusID=Seats.seatIDAND Customers.cusID=Seats.seatIDAND Seats.seatReserved=trueAND Seats.seatReserved=true

3.3. UPDATE SeatsUPDATE SeatsSET seatReserfed=false, cusID=NullSET seatReserfed=false, cusID=NullWHERE seatID=3WHERE seatID=3