Question
Weekly Project In this assignment, youll have to come up with SQL queries for the following database schema: Artists (artistID: int, name: varchar(255)) SimilarArtists (artistID:
Weekly Project
In this assignment, youll have to come up with SQL queries for the following database schema:
Artists (artistID: int, name: varchar(255))
SimilarArtists (artistID: int, simArtistID: int, weight: int)
Albums (albumID: int, artistID: int, name: varchar(255))
Tracks (trackID: int, artistID: int, name: varchar(255), length: int)
TrackLists (albumID: int, trackID: int, trackNum: int)
All primary keys are underlined. All foreign keys have the same name as the primary key that they are referencing. When asking about the similarity of one Artist to another, you can safely assume that the pair of Artists will only appear in one tuple in the SimilarArtists table. Please write SQL statements for the following ten queries:
9. For all Artists that have released a Track with a name beginning with The, give their name and the name of the Artist who is most similar to them that has released a Track witha name beginning with Why. If there is a tie, choose the Artist with the lowest artistID. If there are no qualifying Artists, list the Artist name as null.
Result: (artist_name_the: varchar(255), artist_name_why: varchar(255))
10. If an Artist is within one degree of Hot Water Music that means that their similarity to Hot Water Music is at least 5. If an Artist is within N degrees of Hot Water Music, then they have a similarity of at least 5 to an Artist that is within N-1 degrees of Hot Water Music. Find the percent of all Artists that are within 6 (or fewer) degrees of Hot Water Music. (Your answer should also include Hot Water Music themselves! Also, note that the percentage should be an integer between 0 and 100, inclusive.)
Result: (percentage: int)
Step 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