0

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!

4
  • Probably worth doing some research into t-sql for your given RDBMS (is it MS SQL server or MySQL or some other variant?). What have you tried so far? Commented Mar 20, 2015 at 15:44
  • How is this different to your previous question: stackoverflow.com/questions/29151114/sql-query-select-query Commented Mar 20, 2015 at 15:46
  • its a different query sir Commented Mar 20, 2015 at 15:53
  • do some research on group by in your query Commented Mar 20, 2015 at 17:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.