Question
Assume a club offers members the opportunity to book tickets to workshops: The database should have three tables: o Member, for recording details of each
Assume a club offers members the opportunity to book tickets to workshops:
The database should have three tables:
o Member, for recording details of each club member
o Workshop, for recording details of each workshop
o Booking, for recording details of each booking
Members have a unique four-digit memberID, they also have a first name, surname and, usually, a phone number.
Workshops have a unique three-digit workshop ID, they also have a title, a session date, a price and the number of remaining tickets is also recorded.
For each booking, the ID of the booking member, the ID of the booked workshop, the date of the booking and the quantity of tickets booked is recorded. A member can only have one booking for a given workshop.
A] Write SQL statements to create Member, Workshop and Booking tables with appropriate data types, primary and foreign keys. Ensure the tables will maintain data integrity of:
key constraints
entity integrity constraints
referential integrity constraints
B] Write SQL statements to populate the Member, Workshop and Booking tables with the above instance data.
Write an SQL statement to create a view called sales giving for each workshop, the workshopID, title, session date (formatted as DD/MM/YYYY and called date), total number of tickets sold for that workshop (as total Sales) and number of tickets remaining.
C]
Member memberi 1000 1001 1002 firstName Aksha Eric Zhe surname Shaikh Rostron Ding phone 0456123456 0439774776 0459914321 Workshop workshops 100 101 102 title Firing a steam locomotive Rail signalling Shunt rolling stock sessionDate 2021-12-31 2021-12-17 2021-02-03 price 89.95 55.50 78.00 qtyRemaining 2 9 6 Booking memberi 1001 1000 workshoplD 102 101 qtyTickets 2 1 1002 102 1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started