spider_version
int64
1
2
db_id
stringclasses
204 values
schema
stringclasses
187 values
question
stringlengths
3
328
query
stringlengths
20
3.81k
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Return the dates of ceremony and the results of all music festivals
SELECT Date_of_ceremony , RESULT FROM music_festival
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the dates of ceremony and results for each music festival?
SELECT Date_of_ceremony , RESULT FROM music_festival
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the category of music festivals with result "Awarded"?
SELECT Category FROM music_festival WHERE RESULT = "Awarded"
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Return the categories of music festivals that have the result "Awarded".
SELECT Category FROM music_festival WHERE RESULT = "Awarded"
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the maximum and minimum week on top of all volumes?
SELECT max(Weeks_on_Top) , min(Weeks_on_Top) FROM volume
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Give the maximum and minimum weeks on top across all volumes.
SELECT max(Weeks_on_Top) , min(Weeks_on_Top) FROM volume
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the songs in volumes with more than 1 week on top?
SELECT Song FROM volume WHERE Weeks_on_Top > 1
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Give the songs included in volumes that have more than 1 week on top.
SELECT Song FROM volume WHERE Weeks_on_Top > 1
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Please list all songs in volumes in ascending alphabetical order.
SELECT Song FROM volume ORDER BY Song
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the the songs in volumes, listed in ascending order?
SELECT Song FROM volume ORDER BY Song
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
How many distinct artists do the volumes associate to?
SELECT COUNT(DISTINCT Artist_ID) FROM volume
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Count the number of distinct artists who have volumes.
SELECT COUNT(DISTINCT Artist_ID) FROM volume
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Please show the date of ceremony of the volumes that last more than 2 weeks on top.
SELECT T1.Date_of_ceremony FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T2.Weeks_on_Top > 2
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the dates of ceremony at music festivals corresponding to volumes that lasted more than 2 weeks on top?
SELECT T1.Date_of_ceremony FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T2.Weeks_on_Top > 2
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Please show the songs that have result "nominated" at music festivals.
SELECT T2.Song FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T1.Result = "Nominated"
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the songs in volumes that have resulted in a nomination at music festivals?
SELECT T2.Song FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T1.Result = "Nominated"
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the issue dates of volumes associated with the artist "Gorgoroth"?
SELECT T2.Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Artist = "Gorgoroth"
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Return the issue dates of volumes that are by the artist named Gorgoroth.
SELECT T2.Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Artist = "Gorgoroth"
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the songs in volumes associated with the artist aged 32 or older?
SELECT T2.Song FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age >= 32
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Return names of songs in volumes that are by artists that are at least 32 years old.
SELECT T2.Song FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age >= 32
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What is the average weeks on top of volumes associated with the artist aged 25 or younger?
SELECT avg(T2.Weeks_on_Top) FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age <= 25
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Return the average number of weeks on top for volumes by artists that are at most 25 years old.
SELECT avg(T2.Weeks_on_Top) FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age <= 25
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the famous title of the artists associated with volumes with more than 2 weeks on top?
SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Return the famous titles for artists that have volumes that lasted more than 2 weeks on top.
SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Please list the age and famous title of artists in descending order of age.
SELECT Famous_Title , Age FROM artist ORDER BY Age DESC
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the famous titles and ages of each artist, listed in descending order by age?
SELECT Famous_Title , Age FROM artist ORDER BY Age DESC
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What is the famous release date of the artist with the oldest age?
SELECT Famous_Release_date FROM artist ORDER BY Age DESC LIMIT 1
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Return the famous release date for the oldest artist.
SELECT Famous_Release_date FROM artist ORDER BY Age DESC LIMIT 1
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Please show the categories of the music festivals and the count.
SELECT Category , COUNT(*) FROM music_festival GROUP BY Category
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Return the number of music festivals of each category.
SELECT Category , COUNT(*) FROM music_festival GROUP BY Category
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What is the most common result of the music festival?
SELECT RESULT FROM music_festival GROUP BY RESULT ORDER BY COUNT(*) DESC LIMIT 1
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Return the result that is most frequent at music festivals.
SELECT RESULT FROM music_festival GROUP BY RESULT ORDER BY COUNT(*) DESC LIMIT 1
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Please show the categories of the music festivals with count more than 1.
SELECT Category FROM music_festival GROUP BY Category HAVING COUNT(*) > 1
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the categories of music festivals for which there have been more than 1 music festival?
SELECT Category FROM music_festival GROUP BY Category HAVING COUNT(*) > 1
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What is the song in the volume with the maximum weeks on top?
SELECT Song FROM volume ORDER BY Weeks_on_Top DESC LIMIT 1
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Return the song in the volume that has spent the most weeks on top?
SELECT Song FROM volume ORDER BY Weeks_on_Top DESC LIMIT 1
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Find the famous titles of artists that do not have any volume.
SELECT Famous_Title FROM artist WHERE Artist_ID NOT IN(SELECT Artist_ID FROM volume)
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the famous titles of artists who do not have any volumes?
SELECT Famous_Title FROM artist WHERE Artist_ID NOT IN(SELECT Artist_ID FROM volume)
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Show the famous titles of the artists with both volumes that lasted more than 2 weeks on top and volumes that lasted less than 2 weeks on top.
SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2 INTERSECT SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top < 2
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the famous titles of artists who have not only had volumes that spent more than 2 weeks on top but also volumes that spent less than 2 weeks on top?
SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2 INTERSECT SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top < 2
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the date of ceremony of music festivals with category "Best Song" and result "Awarded"?
SELECT Date_of_ceremony FROM music_festival WHERE Category = "Best Song" AND RESULT = "Awarded"
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Return the dates of ceremony corresponding to music festivals that had the category "Best Song" and result "Awarded".
SELECT Date_of_ceremony FROM music_festival WHERE Category = "Best Song" AND RESULT = "Awarded"
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What is the issue date of the volume with the minimum weeks on top?
SELECT Issue_Date FROM volume ORDER BY Weeks_on_Top ASC LIMIT 1
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Return the issue date of the volume that has spent the fewest weeks on top.
SELECT Issue_Date FROM volume ORDER BY Weeks_on_Top ASC LIMIT 1
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
How many distinct artists have volumes?
SELECT COUNT(DISTINCT Artist_ID) FROM volume
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Count the number of artists who have had volumes.
SELECT COUNT(DISTINCT Artist_ID) FROM volume
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Please show the results of music festivals and the number of music festivals that have had each, ordered by this count.
SELECT RESULT , COUNT(*) FROM music_festival GROUP BY RESULT ORDER BY COUNT(*) DESC
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
How many music festivals have had each kind of result, ordered descending by count?
SELECT RESULT , COUNT(*) FROM music_festival GROUP BY RESULT ORDER BY COUNT(*) DESC
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
What are the issue dates of volumes associated with the artist aged 23 or younger?
SELECT Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age <= 23
1
music_4
CREATE TABLE "artist" ( "Artist_ID" int, "Artist" text, "Age" int, "Famous_Title" text, "Famous_Release_date" text, PRIMARY KEY ("Artist_ID") ); CREATE TABLE "volume" ( "Volume_ID" int, "Volume_Issue" text, "Issue_Date" text, "Weeks_on_Top" real, "Song" text, "Artist_ID" int, PRIMARY KEY ("Volume_ID"), FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`) ); CREATE TABLE "music_festival" ( "ID" int, "Music_Festival" text, "Date_of_ceremony" text, "Category" text, "Volume" int, "Result" text, PRIMARY KEY (`ID`), FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`) )
Return the issue dates of volumes by artists who are at most 23 years old?
SELECT Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age <= 23
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
How many roller coasters are there?
SELECT count(*) FROM roller_coaster
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
List the names of roller coasters by ascending order of length.
SELECT Name FROM roller_coaster ORDER BY LENGTH ASC
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
What are the lengths and heights of roller coasters?
SELECT LENGTH , Height FROM roller_coaster
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
List the names of countries whose language is not "German".
SELECT Name FROM country WHERE Languages != "German"
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
Show the statuses of roller coasters longer than 3300 or higher than 100.
SELECT Status FROM roller_coaster WHERE LENGTH > 3300 OR Height > 100
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
What are the speeds of the longest roller coaster?
SELECT Speed FROM roller_coaster ORDER BY LENGTH DESC LIMIT 1
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
What is the average speed of roller coasters?
SELECT avg(Speed) FROM roller_coaster
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
Show the different statuses and the numbers of roller coasters for each status.
SELECT Status , COUNT(*) FROM roller_coaster GROUP BY Status
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
Please show the most common status of roller coasters.
SELECT Status FROM roller_coaster GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
List the status shared by more than two roller coaster.
SELECT Status FROM roller_coaster GROUP BY Status HAVING COUNT(*) > 2
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
Show the park of the roller coaster with the highest speed.
SELECT Park FROM roller_coaster ORDER BY Speed DESC LIMIT 1
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
Show the names of roller coasters and names of country they are in.
SELECT T2.Name , T1.Name FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
Show the names of countries that have more than one roller coaster.
SELECT T1.Name FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID GROUP BY T1.Name HAVING COUNT(*) > 1
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
Show the name and population of the country that has the highest roller coaster.
SELECT T1.Name , T1.population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID ORDER BY T2.Height DESC LIMIT 1
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
Show the names of countries and the average speed of roller coasters from each country.
SELECT T1.Name , avg(T2.Speed) FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID GROUP BY T1.Name
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
How many countries do not have an roller coaster longer than 3000?
SELECT count(*) FROM country WHERE country_id NOT IN ( SELECT country_id FROM roller_coaster WHERE LENGTH > 3000 )
1
roller_coaster
CREATE TABLE "roller_coaster" ( "Roller_Coaster_ID" int, "Name" text, "Park" text, "Country_ID" int, "Length" real, "Height" real, "Speed" text, "Opened" text, "Status" text, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY ("Country_ID") REFERENCES `country`("Country_ID") ); CREATE TABLE "country" ( "Country_ID" int, "Name" text, "Population" int, "Area" int, "Languages" text, PRIMARY KEY ("Country_ID") )
What are the country names, area and population which has both roller coasters with speed higher
SELECT T1.name , T1.area , T1.population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID WHERE T2.speed > 60 INTERSECT SELECT T1.name , T1.area , T1.population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID WHERE T2.speed < 55
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
How many different captain ranks are there?
SELECT count(DISTINCT rank) FROM captain
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Count the number of different ranks of captain.
SELECT count(DISTINCT rank) FROM captain
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
How many captains are in each rank?
SELECT count(*) , rank FROM captain GROUP BY rank
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Count the number of captains that have each rank.
SELECT count(*) , rank FROM captain GROUP BY rank
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
How many captains with younger than 50 are in each rank?
SELECT count(*) , rank FROM captain WHERE age < 50 GROUP BY rank
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Count the number of captains younger than 50 of each rank.
SELECT count(*) , rank FROM captain WHERE age < 50 GROUP BY rank
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Sort all captain names by their ages from old to young.
SELECT name FROM captain ORDER BY age DESC
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
What are the names of captains, sorted by age descending?
SELECT name FROM captain ORDER BY age DESC
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Find the name, class and rank of all captains.
SELECT name , CLASS , rank FROM captain
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
What are the names, classes, and ranks of all captains?
SELECT name , CLASS , rank FROM captain
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Which rank is the most common among captains?
SELECT rank FROM captain GROUP BY rank ORDER BY count(*) DESC LIMIT 1
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Return the rank for which there are the fewest captains.
SELECT rank FROM captain GROUP BY rank ORDER BY count(*) DESC LIMIT 1
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Which classes have more than two captains?
SELECT CLASS FROM captain GROUP BY CLASS HAVING count(*) > 2
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Give the classes that have more than two captains.
SELECT CLASS FROM captain GROUP BY CLASS HAVING count(*) > 2
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Find the name of captains whose rank are either Midshipman or Lieutenant.
SELECT name FROM captain WHERE rank = 'Midshipman' OR rank = 'Lieutenant'
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
What are the names of captains that have either the rank Midshipman or Lieutenant?
SELECT name FROM captain WHERE rank = 'Midshipman' OR rank = 'Lieutenant'
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
What are the average and minimum age of captains in different class?
SELECT avg(age) , min(age) , CLASS FROM captain GROUP BY CLASS
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Return the average and minimum age of captains in each class.
SELECT avg(age) , min(age) , CLASS FROM captain GROUP BY CLASS
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Find the captain rank that has some captains in both Cutter and Armed schooner classes.
SELECT rank FROM captain WHERE CLASS = 'Cutter' INTERSECT SELECT rank FROM captain WHERE CLASS = 'Armed schooner'
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
What are the ranks of captains that are both in the Cutter and Armed schooner classes?
SELECT rank FROM captain WHERE CLASS = 'Cutter' INTERSECT SELECT rank FROM captain WHERE CLASS = 'Armed schooner'
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Find the captain rank that has no captain in Third-rate ship of the line class.
SELECT rank FROM captain EXCEPT SELECT rank FROM captain WHERE CLASS = 'Third-rate ship of the line'
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
What are the ranks of captains that have no captain that are in the Third-rate ship of the line class?
SELECT rank FROM captain EXCEPT SELECT rank FROM captain WHERE CLASS = 'Third-rate ship of the line'
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
What is the name of the youngest captain?
SELECT name FROM captain ORDER BY age LIMIT 1
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Return the name of the youngest captain.
SELECT name FROM captain ORDER BY age LIMIT 1
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
how many ships are there?
SELECT count(*) FROM ship
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Count the number of ships.
SELECT count(*) FROM ship
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Find the name, type, and flag of the ship that is built in the most recent year.
SELECT name , TYPE , flag FROM ship ORDER BY built_year DESC LIMIT 1
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
What is the name, type, and flag of the ship that was built in the most recent year?
SELECT name , TYPE , flag FROM ship ORDER BY built_year DESC LIMIT 1
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Group by ships by flag, and return number of ships that have each flag.
SELECT count(*) , flag FROM ship GROUP BY flag
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
What are the different ship flags, and how many ships have each?
SELECT count(*) , flag FROM ship GROUP BY flag
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Which flag is most widely used among all ships?
SELECT flag FROM ship GROUP BY flag ORDER BY count(*) DESC LIMIT 1
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
Return the flag that is most common among all ships.
SELECT flag FROM ship GROUP BY flag ORDER BY count(*) DESC LIMIT 1
1
ship_1
CREATE TABLE "captain" ( "Captain_ID" int, "Name" text, "Ship_ID" int, "age" text, "Class" text, "Rank" text, PRIMARY KEY ("Captain_ID"), FOREIGN KEY ("Ship_ID") REFERENCES "Ship"("Ship_ID") ); CREATE TABLE "Ship" ( "Ship_ID" int, "Name" text, "Type" text, "Built_Year" real, "Class" text, "Flag" text, PRIMARY KEY ("Ship_ID") )
List all ship names in the order of built year and class.
SELECT name FROM ship ORDER BY built_year , CLASS