This document contains 3 SQL queries:
1) Lists books ordered on a particular date alphabetically by title
2) Lists non-English books alphabetically by title
3) Calculates the total minutes of songs on albums by the artist "Homer", grouping results by artist and album title
This document contains 3 SQL queries:
1) Lists books ordered on a particular date alphabetically by title
2) Lists non-English books alphabetically by title
3) Calculates the total minutes of songs on albums by the artist "Homer", grouping results by artist and album title
This document contains 3 SQL queries:
1) Lists books ordered on a particular date alphabetically by title
2) Lists non-English books alphabetically by title
3) Calculates the total minutes of songs on albums by the artist "Homer", grouping results by artist and album title
1. Alphabetical list of books that were ordered on [particular date]
SELECT b.title, co.order_date FROM book b JOIN cust_order co ON b.book_id WHERE DATE(co.order_date) = '2023-02-15' ORDER BY b.title ASC;
2. Alphabetical list of books that are not english
SELECT b.title, bl.language_name FROM book b LEFT JOIN book_language bl ON b.language_id = bl.language_id WHERE bl.language_name NOT LIKE '%English%' ORDER BY b.title;
3. Total number of minutes
SELECT artists.name AS artist_name, albums.title AS album_title, SEC_TO_TIME(SUM(TIME_TO_SEC(songs.duration)/60)) AS total_minutes FROM Albums INNER JOIN artists ON albums.artist = artists.id INNER JOIN songs ON albums.id = songs.album WHERE artists.name = 'Homer' GROUP BY artists.name, albums.title;