Sample Exam
Sample Exam
- Location which includes the information of the locations where the shows take place: ID,
name, address.
- Show which includes the information of the shows: ID, name, date and time, location.
- Ticket type which includes the information of the ticket types: ID, name, corresponding
show, price, quantity.
- Attendee which includes the information of the customers who have purchased a ticket:
ID, name, birthday, gender, ticket type.
1. Design the required database using the entity-relationship (ER) model, with all the necessary
entities, attributes and relationships.
2. Convert the above database to the relational model, ensuring that the given database model
satisfies the functional dependency requirements for data redundancy.
3. Specify all the primary and foreign keys of the relations in the designed database.
Write the SQL statements to establish the designed database.
4. Write the SQL statements to: Add a show with at least 3 different types of tickets (students can
key in the sample information).
5. Use relational algebra to write the following query: Find the attendees (ID, name) who have
invited tickets for a show at the Opera House on July 24, 2023.
Then write the corresponding SQL statement for this query.
6. Write SQL statement to: Calculate the total revenue for all the shows in July 2023.
7. Write SQL statement to: List the shows (ID, name) together with the revenue of those shows,
sorted by date of the show in descending order.
8. Write SQL statement to: Find the future show (ID, name) with the most number of tickets
having not been sold out.
9. Write SQL statement to: List the attendees (ID, name) with tickets for all the shows in July
2023.
10. Write SQL statement to: List the shows (ID, name) where more than 50% of the attendees
who have purchased tickets are 20 years old or younger.