input
stringlengths
191
7.13k
output
stringlengths
19
578
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students does each advisor have? [/INST]
SELECT advisor , count(*) FROM Student GROUP BY advisor;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Which advisor has most number of students? [/INST...
SELECT advisor FROM Student GROUP BY advisor ORDER BY count(*) DESC LIMIT 1;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Give the advisor with the most students. [/INST]
SELECT advisor FROM Student GROUP BY advisor ORDER BY count(*) DESC LIMIT 1;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students have cat allergies? [/INST]
SELECT count(*) FROM Has_allergy WHERE Allergy = "Cat";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students are affected by cat allergies? ...
SELECT count(*) FROM Has_allergy WHERE Allergy = "Cat";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show all student IDs who have at least two allerg...
SELECT StuID FROM Has_allergy GROUP BY StuID HAVING count(*) >= 2;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the students ids of students who have mo...
SELECT StuID FROM Has_allergy GROUP BY StuID HAVING count(*) >= 2;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the student ids of students who don't ha...
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Which students are unaffected by allergies? [/INS...
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many female students have milk or egg allergi...
SELECT count(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.sex = "F" AND T1.allergy = "Milk" OR T1.allergy = "Eggs";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students who are female are allergic to ...
SELECT count(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.sex = "F" AND T1.allergy = "Milk" OR T1.allergy = "Eggs";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students have a food allergy? [/INST]
SELECT count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = "food";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students are affected by food related al...
SELECT count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = "food";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Which allergy has most number of students affecte...
SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY count(*) DESC LIMIT 1;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Which allergy is the most common? [/INST]
SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY count(*) DESC LIMIT 1;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show all allergies with number of students affect...
SELECT Allergy , count(*) FROM Has_allergy GROUP BY Allergy;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students have each different allergy? [/...
SELECT Allergy , count(*) FROM Has_allergy GROUP BY Allergy;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show all allergy type with number of students aff...
SELECT T2.allergytype , count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students are affected by each allergy ty...
SELECT T2.allergytype , count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Find the last name and age of the student who has...
SELECT lname , age FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Milk" INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = "Cat");
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the last names and ages of the students ...
SELECT lname , age FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Milk" INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = "Cat");
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the allergies and their types that the s...
SELECT T1.Allergy , T1.AllergyType FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = "Lisa" ORDER BY T1.Allergy;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the allergies the girl named Lisa has? A...
SELECT T1.Allergy , T1.AllergyType FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = "Lisa" ORDER BY T1.Allergy;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Find the first name and gender of the student who...
SELECT fname , sex FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Milk" EXCEPT SELECT StuID FROM Has_allergy WHERE Allergy = "Cat");
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the first name and gender of the student...
SELECT fname , sex FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Milk" EXCEPT SELECT StuID FROM Has_allergy WHERE Allergy = "Cat");
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Find the average age of the students who have all...
SELECT avg(age) FROM Student WHERE StuID IN ( SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food" INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "animal");
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How old are the students with allergies to food a...
SELECT avg(age) FROM Student WHERE StuID IN ( SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food" INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "animal");
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: List the first and last name of the students who ...
SELECT fname , lname FROM Student WHERE StuID NOT IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food");
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What is the full name of each student who is not ...
SELECT fname , lname FROM Student WHERE StuID NOT IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food");
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Find the number of male (sex is 'M') students who...
SELECT count(*) FROM Student WHERE sex = "M" AND StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food");
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many male students (sex is 'M') are allergic ...
SELECT count(*) FROM Student WHERE sex = "M" AND StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food");
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Find the different first names and cities of the ...
SELECT DISTINCT T1.fname , T1.city_code FROM Student AS T1 JOIN Has_Allergy AS T2 ON T1.stuid = T2.stuid WHERE T2.Allergy = "Milk" OR T2.Allergy = "Cat";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the distinct first names and cities of t...
SELECT DISTINCT T1.fname , T1.city_code FROM Student AS T1 JOIN Has_Allergy AS T2 ON T1.stuid = T2.stuid WHERE T2.Allergy = "Milk" OR T2.Allergy = "Cat";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Find the number of students who are older than 18...
SELECT count(*) FROM Student WHERE age > 18 AND StuID NOT IN ( SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food" OR T2.allergytype = "animal");
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students are over 18 and do not have all...
SELECT count(*) FROM Student WHERE age > 18 AND StuID NOT IN ( SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food" OR T2.allergytype = "animal");
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Find the first name and major of the students who...
SELECT fname , major FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Soy");
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the first name and major of the students...
SELECT fname , major FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Soy");
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT billing_country , COUNT(*) FROM invoices GROUP BY billing_country ORDER BY count(*) DESC LIMIT 5;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT billing_country , COUNT(*) FROM invoices GROUP BY billing_country ORDER BY count(*) DESC LIMIT 5;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT billing_country , SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT billing_country , SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT billing_country , AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT billing_country , AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T1.first_name , T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY T2.invoice_date DESC LIMIT 5;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T1.first_name , T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY T2.invoice_date DESC LIMIT 5;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T1.first_name , T1.last_name , COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 10;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T1.first_name , T1.last_name , COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 10;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T1.first_name , T1.last_name , SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T1.first_name , T1.last_name , SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T1.name , COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id = T1.id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 5;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T1.name , COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id = T1.id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 5;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT title FROM albums;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT title FROM albums;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT title FROM albums ORDER BY title;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT title FROM albums ORDER BY title;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T1.first_name , T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY total LIMIT 10;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T1.first_name , T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY total LIMIT 10;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT sum(total) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT sum(total) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT COUNT(*) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT COUNT(*) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT billing_state , COUNT(*) , SUM(total) FROM invoices WHERE billing_state = "CA";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT billing_state , COUNT(*) , SUM(total) FROM invoices WHERE billing_state = "CA";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Aerosmith";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Aerosmith";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT count(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Billy Cobham";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT count(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Billy Cobham";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT company FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT company FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT email , phone FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT email , phone FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT count(*) FROM customers WHERE city = "Prague";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT count(*) FROM customers WHERE city = "Prague";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT count(*) FROM customers WHERE state = "CA";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT count(*) FROM customers WHERE state = "CA";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT country FROM customers WHERE first_name = "Roberto" AND last_name = "Almeida";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT country FROM customers WHERE first_name = "Roberto" AND last_name = "Almeida";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%';
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%';
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT count(*) FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = "Steve" AND T1.last_name = "Johnson";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT count(*) FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = "Steve" AND T1.last_name = "Johnson";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT title , phone , hire_date FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT title , phone , hire_date FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T2.first_name , T2.last_name FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = "Nancy" AND T1.last_name = "Edwards";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T2.first_name , T2.last_name FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = "Nancy" AND T1.last_name = "Edwards";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT address FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT address FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T1.first_name , T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id = T2.support_rep_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT T1.first_name , T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id = T2.support_rep_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1;
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT count(*) FROM employees WHERE country = "Canada";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT count(*) FROM employees WHERE country = "Canada";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT phone FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT phone FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
Tables: artists, sqlite_sequence, albums, employees, customers, genres, invoices, media_types, tracks, invoice_lines, playlists, playlist_tracks Columns: artists.id, artists.name, sqlite_sequence.name, sqlite_sequence.seq, albums.id, albums.title, albums.artist_id, employees.id, employees.last_name, employees.first_nam...
SELECT first_name , last_name FROM employees ORDER BY birth_date DESC LIMIT 1;