Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using the database: Write SQL queries for each of the questions below A)Find the

ID: 3872574 • Letter: U

Question

Using the database: Write SQL queries for each of the questions below

A)Find the artists who have recorded more than 10 albums. Print the Id, and name of such artists. Also print the number of albums for such artists. Number of rows returned in the result = 3

B) Find the customers who are served by support representatives based in the same State as the customer. Print the first and last name of the customer and the support representative, and the State in which they are located. Number of rows returned in the result = 1

TEE Track Trackld T Album Artist Artistld Name MediaType MediaTypeld Name Tite Artistld Albumld MediaTypeld Genreld Composer Milliseconds Genre Genreld Name Playlist Playlistd Name PlaylistTrack Playlistic Trackld Bytes UnitPrice Employee Employeeld LastName FirstName InvoiceLine InvoiceLineld Invoiceld Trackld UnitPrice Quantity Customer Customerld FirstName LastName Company Address ReportsTo BirthDate HireDate Address City State Country PostalCode Phone Fax Email Invoice Invoiceld Customerld InvoiceDate illingAddress BillingCity BillingState BillingCountry State Country PostalCode Fax SupportRepld Total

Explanation / Answer

1)

select a.ArtistId,a.Name from Artist a,Album ab,Track t,Genre g where a.ArtistId=ab.ArtistId and ab.AlbumId=t.AlbumId and t.GenreId=g.GenreId and g.Name='Rock';

A)

select a.ArtistId,a.Name,count(ab.AlbumId) as count from Artist a,Album ab where a.ArtistId=ab.ArtistId having count(ab.AlbumId) >20;

B)

select c.FirstName,c.LastName,c.SupportRepId from Customer c,Employee e where c.SupportRepd=e.EmployeeId and e.State=c.State;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote