Here are my database relations:
shows(showID, title, premiere_year, network, creator, category)
episode(showID, episodeID, airdate, title)
- showID is a foreign key to shows
actor(actID, fname, lname)
main_cast(showID, actID, role)
- showID is a foreign key to shows actID is a foreign key to actor
recurring_cast(showID, episodeID, actID, role)
- showID is a foreign key to shows episodeID is a foreign key to episode
- actID is a foreign key to actor
customer(custID, fname, lname, email, creditcard,membersince,renewaldate, password, username)
cust_queue(custID, showID, datequeued)
- custID is a foreign key to customer showID is a foreign key to shows
watched(custID, showID, episodeID, datewatched)
- custID is a foreign key to customer
- showID is a foreign key to shows
- (showID, episodeID) is a foreign key to episode
- (custID, showID) is a foreign key to cust_queue
All the 'IDs' are primary keys
I have queries I was given and for some, I don't know how to go about it. Such as:
Find all shows that have more than 5 seasons. Display the title of the show, and the number of seasons. Sort the result by the number of seasons. Note that the first digit of each episode number represents the season number.
I don't really know how to solve this. Please help!
group byin your query