db_id
stringclasses 140
values | schema
listlengths 0
26
| question
stringlengths 16
224
| query
stringlengths 18
577
| query_toks
listlengths 4
90
| query_toks_no_value
listlengths 4
125
| question_toks
listlengths 4
44
|
---|---|---|---|---|---|---|
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
How many students does each advisor have?
|
SELECT advisor , count(*) FROM Student GROUP BY advisor
|
[
"SELECT",
"advisor",
",",
"count",
"(",
"*",
")",
"FROM",
"Student",
"GROUP",
"BY",
"advisor"
] |
[
"select",
"advisor",
",",
"count",
"(",
"*",
")",
"from",
"student",
"group",
"by",
"advisor"
] |
[
"How",
"many",
"students",
"does",
"each",
"advisor",
"have",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Which advisor has most number of students?
|
SELECT advisor FROM Student GROUP BY advisor ORDER BY count(*) DESC LIMIT 1
|
[
"SELECT",
"advisor",
"FROM",
"Student",
"GROUP",
"BY",
"advisor",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"advisor",
"from",
"student",
"group",
"by",
"advisor",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"Which",
"advisor",
"has",
"most",
"number",
"of",
"students",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Give the advisor with the most students.
|
SELECT advisor FROM Student GROUP BY advisor ORDER BY count(*) DESC LIMIT 1
|
[
"SELECT",
"advisor",
"FROM",
"Student",
"GROUP",
"BY",
"advisor",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"advisor",
"from",
"student",
"group",
"by",
"advisor",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"Give",
"the",
"advisor",
"with",
"the",
"most",
"students",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
How many students have cat allergies?
|
SELECT count(*) FROM Has_allergy WHERE Allergy = "Cat"
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"Has_allergy",
"WHERE",
"Allergy",
"=",
"``",
"Cat",
"''"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"has_allergy",
"where",
"allergy",
"=",
"value"
] |
[
"How",
"many",
"students",
"have",
"cat",
"allergies",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
How many students are affected by cat allergies?
|
SELECT count(*) FROM Has_allergy WHERE Allergy = "Cat"
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"Has_allergy",
"WHERE",
"Allergy",
"=",
"``",
"Cat",
"''"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"has_allergy",
"where",
"allergy",
"=",
"value"
] |
[
"How",
"many",
"students",
"are",
"affected",
"by",
"cat",
"allergies",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Show all student IDs who have at least two allergies.
|
SELECT StuID FROM Has_allergy GROUP BY StuID HAVING count(*) >= 2
|
[
"SELECT",
"StuID",
"FROM",
"Has_allergy",
"GROUP",
"BY",
"StuID",
"HAVING",
"count",
"(",
"*",
")",
">",
"=",
"2"
] |
[
"select",
"stuid",
"from",
"has_allergy",
"group",
"by",
"stuid",
"having",
"count",
"(",
"*",
")",
">",
"=",
"value"
] |
[
"Show",
"all",
"student",
"IDs",
"who",
"have",
"at",
"least",
"two",
"allergies",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
What are the students ids of students who have more than one allergy?
|
SELECT StuID FROM Has_allergy GROUP BY StuID HAVING count(*) >= 2
|
[
"SELECT",
"StuID",
"FROM",
"Has_allergy",
"GROUP",
"BY",
"StuID",
"HAVING",
"count",
"(",
"*",
")",
">",
"=",
"2"
] |
[
"select",
"stuid",
"from",
"has_allergy",
"group",
"by",
"stuid",
"having",
"count",
"(",
"*",
")",
">",
"=",
"value"
] |
[
"What",
"are",
"the",
"students",
"ids",
"of",
"students",
"who",
"have",
"more",
"than",
"one",
"allergy",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
What are the student ids of students who don't have any allergies?
|
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy
|
[
"SELECT",
"StuID",
"FROM",
"Student",
"EXCEPT",
"SELECT",
"StuID",
"FROM",
"Has_allergy"
] |
[
"select",
"stuid",
"from",
"student",
"except",
"select",
"stuid",
"from",
"has_allergy"
] |
[
"What",
"are",
"the",
"student",
"ids",
"of",
"students",
"who",
"do",
"n't",
"have",
"any",
"allergies",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Which students are unaffected by allergies?
|
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy
|
[
"SELECT",
"StuID",
"FROM",
"Student",
"EXCEPT",
"SELECT",
"StuID",
"FROM",
"Has_allergy"
] |
[
"select",
"stuid",
"from",
"student",
"except",
"select",
"stuid",
"from",
"has_allergy"
] |
[
"Which",
"students",
"are",
"unaffected",
"by",
"allergies",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
How many female students have milk or egg allergies?
|
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"
|
[
"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",
"''"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"has_allergy",
"as",
"t1",
"join",
"student",
"as",
"t2",
"on",
"t1",
".",
"stuid",
"=",
"t2",
".",
"stuid",
"where",
"t2",
".",
"sex",
"=",
"value",
"and",
"t1",
".",
"allergy",
"=",
"value",
"or",
"t1",
".",
"allergy",
"=",
"value"
] |
[
"How",
"many",
"female",
"students",
"have",
"milk",
"or",
"egg",
"allergies",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
How many students who are female are allergic to milk or eggs?
|
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"
|
[
"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",
"''"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"has_allergy",
"as",
"t1",
"join",
"student",
"as",
"t2",
"on",
"t1",
".",
"stuid",
"=",
"t2",
".",
"stuid",
"where",
"t2",
".",
"sex",
"=",
"value",
"and",
"t1",
".",
"allergy",
"=",
"value",
"or",
"t1",
".",
"allergy",
"=",
"value"
] |
[
"How",
"many",
"students",
"who",
"are",
"female",
"are",
"allergic",
"to",
"milk",
"or",
"eggs",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
How many students have a food allergy?
|
SELECT count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = "food"
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"Has_allergy",
"AS",
"T1",
"JOIN",
"Allergy_type",
"AS",
"T2",
"ON",
"T1.allergy",
"=",
"T2.allergy",
"WHERE",
"T2.allergytype",
"=",
"``",
"food",
"''"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"has_allergy",
"as",
"t1",
"join",
"allergy_type",
"as",
"t2",
"on",
"t1",
".",
"allergy",
"=",
"t2",
".",
"allergy",
"where",
"t2",
".",
"allergytype",
"=",
"value"
] |
[
"How",
"many",
"students",
"have",
"a",
"food",
"allergy",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
How many students are affected by food related allergies?
|
SELECT count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = "food"
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"Has_allergy",
"AS",
"T1",
"JOIN",
"Allergy_type",
"AS",
"T2",
"ON",
"T1.allergy",
"=",
"T2.allergy",
"WHERE",
"T2.allergytype",
"=",
"``",
"food",
"''"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"has_allergy",
"as",
"t1",
"join",
"allergy_type",
"as",
"t2",
"on",
"t1",
".",
"allergy",
"=",
"t2",
".",
"allergy",
"where",
"t2",
".",
"allergytype",
"=",
"value"
] |
[
"How",
"many",
"students",
"are",
"affected",
"by",
"food",
"related",
"allergies",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Which allergy has most number of students affected?
|
SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY count(*) DESC LIMIT 1
|
[
"SELECT",
"Allergy",
"FROM",
"Has_allergy",
"GROUP",
"BY",
"Allergy",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"allergy",
"from",
"has_allergy",
"group",
"by",
"allergy",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"Which",
"allergy",
"has",
"most",
"number",
"of",
"students",
"affected",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Which allergy is the most common?
|
SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY count(*) DESC LIMIT 1
|
[
"SELECT",
"Allergy",
"FROM",
"Has_allergy",
"GROUP",
"BY",
"Allergy",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"allergy",
"from",
"has_allergy",
"group",
"by",
"allergy",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"Which",
"allergy",
"is",
"the",
"most",
"common",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Show all allergies with number of students affected.
|
SELECT Allergy , count(*) FROM Has_allergy GROUP BY Allergy
|
[
"SELECT",
"Allergy",
",",
"count",
"(",
"*",
")",
"FROM",
"Has_allergy",
"GROUP",
"BY",
"Allergy"
] |
[
"select",
"allergy",
",",
"count",
"(",
"*",
")",
"from",
"has_allergy",
"group",
"by",
"allergy"
] |
[
"Show",
"all",
"allergies",
"with",
"number",
"of",
"students",
"affected",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
How many students have each different allergy?
|
SELECT Allergy , count(*) FROM Has_allergy GROUP BY Allergy
|
[
"SELECT",
"Allergy",
",",
"count",
"(",
"*",
")",
"FROM",
"Has_allergy",
"GROUP",
"BY",
"Allergy"
] |
[
"select",
"allergy",
",",
"count",
"(",
"*",
")",
"from",
"has_allergy",
"group",
"by",
"allergy"
] |
[
"How",
"many",
"students",
"have",
"each",
"different",
"allergy",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Show all allergy type with number of students affected.
|
SELECT T2.allergytype , count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype
|
[
"SELECT",
"T2.allergytype",
",",
"count",
"(",
"*",
")",
"FROM",
"Has_allergy",
"AS",
"T1",
"JOIN",
"Allergy_type",
"AS",
"T2",
"ON",
"T1.allergy",
"=",
"T2.allergy",
"GROUP",
"BY",
"T2.allergytype"
] |
[
"select",
"t2",
".",
"allergytype",
",",
"count",
"(",
"*",
")",
"from",
"has_allergy",
"as",
"t1",
"join",
"allergy_type",
"as",
"t2",
"on",
"t1",
".",
"allergy",
"=",
"t2",
".",
"allergy",
"group",
"by",
"t2",
".",
"allergytype"
] |
[
"Show",
"all",
"allergy",
"type",
"with",
"number",
"of",
"students",
"affected",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
How many students are affected by each allergy type?
|
SELECT T2.allergytype , count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype
|
[
"SELECT",
"T2.allergytype",
",",
"count",
"(",
"*",
")",
"FROM",
"Has_allergy",
"AS",
"T1",
"JOIN",
"Allergy_type",
"AS",
"T2",
"ON",
"T1.allergy",
"=",
"T2.allergy",
"GROUP",
"BY",
"T2.allergytype"
] |
[
"select",
"t2",
".",
"allergytype",
",",
"count",
"(",
"*",
")",
"from",
"has_allergy",
"as",
"t1",
"join",
"allergy_type",
"as",
"t2",
"on",
"t1",
".",
"allergy",
"=",
"t2",
".",
"allergy",
"group",
"by",
"t2",
".",
"allergytype"
] |
[
"How",
"many",
"students",
"are",
"affected",
"by",
"each",
"allergy",
"type",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Find the last name and age of the student who has allergy to both milk and cat.
|
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")
|
[
"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",
"''",
")"
] |
[
"select",
"lname",
",",
"age",
"from",
"student",
"where",
"stuid",
"in",
"(",
"select",
"stuid",
"from",
"has_allergy",
"where",
"allergy",
"=",
"value",
"intersect",
"select",
"stuid",
"from",
"has_allergy",
"where",
"allergy",
"=",
"value",
")"
] |
[
"Find",
"the",
"last",
"name",
"and",
"age",
"of",
"the",
"student",
"who",
"has",
"allergy",
"to",
"both",
"milk",
"and",
"cat",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
What are the last names and ages of the students who are allergic to milk and cat?
|
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")
|
[
"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",
"''",
")"
] |
[
"select",
"lname",
",",
"age",
"from",
"student",
"where",
"stuid",
"in",
"(",
"select",
"stuid",
"from",
"has_allergy",
"where",
"allergy",
"=",
"value",
"intersect",
"select",
"stuid",
"from",
"has_allergy",
"where",
"allergy",
"=",
"value",
")"
] |
[
"What",
"are",
"the",
"last",
"names",
"and",
"ages",
"of",
"the",
"students",
"who",
"are",
"allergic",
"to",
"milk",
"and",
"cat",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
What are the allergies and their types that the student with first name Lisa has? And order the result by name of allergies.
|
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
|
[
"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"
] |
[
"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",
"=",
"value",
"order",
"by",
"t1",
".",
"allergy"
] |
[
"What",
"are",
"the",
"allergies",
"and",
"their",
"types",
"that",
"the",
"student",
"with",
"first",
"name",
"Lisa",
"has",
"?",
"And",
"order",
"the",
"result",
"by",
"name",
"of",
"allergies",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
What are the allergies the girl named Lisa has? And what are the types of them? Order the result by allergy names.
|
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
|
[
"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"
] |
[
"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",
"=",
"value",
"order",
"by",
"t1",
".",
"allergy"
] |
[
"What",
"are",
"the",
"allergies",
"the",
"girl",
"named",
"Lisa",
"has",
"?",
"And",
"what",
"are",
"the",
"types",
"of",
"them",
"?",
"Order",
"the",
"result",
"by",
"allergy",
"names",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Find the first name and gender of the student who has allergy to milk but not cat.
|
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")
|
[
"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",
"''",
")"
] |
[
"select",
"fname",
",",
"sex",
"from",
"student",
"where",
"stuid",
"in",
"(",
"select",
"stuid",
"from",
"has_allergy",
"where",
"allergy",
"=",
"value",
"except",
"select",
"stuid",
"from",
"has_allergy",
"where",
"allergy",
"=",
"value",
")"
] |
[
"Find",
"the",
"first",
"name",
"and",
"gender",
"of",
"the",
"student",
"who",
"has",
"allergy",
"to",
"milk",
"but",
"not",
"cat",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
What are the first name and gender of the students who have allergy to milk but can put up with cats?
|
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")
|
[
"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",
"''",
")"
] |
[
"select",
"fname",
",",
"sex",
"from",
"student",
"where",
"stuid",
"in",
"(",
"select",
"stuid",
"from",
"has_allergy",
"where",
"allergy",
"=",
"value",
"except",
"select",
"stuid",
"from",
"has_allergy",
"where",
"allergy",
"=",
"value",
")"
] |
[
"What",
"are",
"the",
"first",
"name",
"and",
"gender",
"of",
"the",
"students",
"who",
"have",
"allergy",
"to",
"milk",
"but",
"can",
"put",
"up",
"with",
"cats",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Find the average age of the students who have allergies with food and animal types.
|
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")
|
[
"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",
"''",
")"
] |
[
"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",
"=",
"value",
"intersect",
"select",
"t1",
".",
"stuid",
"from",
"has_allergy",
"as",
"t1",
"join",
"allergy_type",
"as",
"t2",
"on",
"t1",
".",
"allergy",
"=",
"t2",
".",
"allergy",
"where",
"t2",
".",
"allergytype",
"=",
"value",
")"
] |
[
"Find",
"the",
"average",
"age",
"of",
"the",
"students",
"who",
"have",
"allergies",
"with",
"food",
"and",
"animal",
"types",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
How old are the students with allergies to food and animal types on average?
|
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")
|
[
"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",
"''",
")"
] |
[
"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",
"=",
"value",
"intersect",
"select",
"t1",
".",
"stuid",
"from",
"has_allergy",
"as",
"t1",
"join",
"allergy_type",
"as",
"t2",
"on",
"t1",
".",
"allergy",
"=",
"t2",
".",
"allergy",
"where",
"t2",
".",
"allergytype",
"=",
"value",
")"
] |
[
"How",
"old",
"are",
"the",
"students",
"with",
"allergies",
"to",
"food",
"and",
"animal",
"types",
"on",
"average",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
List the first and last name of the students who do not have any food type allergy.
|
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")
|
[
"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",
"''",
")"
] |
[
"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",
"=",
"value",
")"
] |
[
"List",
"the",
"first",
"and",
"last",
"name",
"of",
"the",
"students",
"who",
"do",
"not",
"have",
"any",
"food",
"type",
"allergy",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
What is the full name of each student who is not allergic to any type of food.
|
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")
|
[
"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",
"''",
")"
] |
[
"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",
"=",
"value",
")"
] |
[
"What",
"is",
"the",
"full",
"name",
"of",
"each",
"student",
"who",
"is",
"not",
"allergic",
"to",
"any",
"type",
"of",
"food",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Find the number of male (sex is 'M') students who have some food type allery.
|
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")
|
[
"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",
"''",
")"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"student",
"where",
"sex",
"=",
"value",
"and",
"stuid",
"in",
"(",
"select",
"stuid",
"from",
"has_allergy",
"as",
"t1",
"join",
"allergy_type",
"as",
"t2",
"on",
"t1",
".",
"allergy",
"=",
"t2",
".",
"allergy",
"where",
"t2",
".",
"allergytype",
"=",
"value",
")"
] |
[
"Find",
"the",
"number",
"of",
"male",
"(",
"sex",
"is",
"'M",
"'",
")",
"students",
"who",
"have",
"some",
"food",
"type",
"allery",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
How many male students (sex is 'M') are allergic to any type of food?
|
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")
|
[
"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",
"''",
")"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"student",
"where",
"sex",
"=",
"value",
"and",
"stuid",
"in",
"(",
"select",
"stuid",
"from",
"has_allergy",
"as",
"t1",
"join",
"allergy_type",
"as",
"t2",
"on",
"t1",
".",
"allergy",
"=",
"t2",
".",
"allergy",
"where",
"t2",
".",
"allergytype",
"=",
"value",
")"
] |
[
"How",
"many",
"male",
"students",
"(",
"sex",
"is",
"'M",
"'",
")",
"are",
"allergic",
"to",
"any",
"type",
"of",
"food",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Find the different first names and cities of the students who have allergy to milk or cat.
|
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"
|
[
"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",
"''"
] |
[
"select",
"distinct",
"t1",
".",
"fname",
",",
"t1",
".",
"city_code",
"from",
"student",
"as",
"t1",
"join",
"has_allergy",
"as",
"t2",
"on",
"t1",
".",
"stuid",
"=",
"t2",
".",
"stuid",
"where",
"t2",
".",
"allergy",
"=",
"value",
"or",
"t2",
".",
"allergy",
"=",
"value"
] |
[
"Find",
"the",
"different",
"first",
"names",
"and",
"cities",
"of",
"the",
"students",
"who",
"have",
"allergy",
"to",
"milk",
"or",
"cat",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
What are the distinct first names and cities of the students who have allergy either to milk or to cat?
|
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"
|
[
"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",
"''"
] |
[
"select",
"distinct",
"t1",
".",
"fname",
",",
"t1",
".",
"city_code",
"from",
"student",
"as",
"t1",
"join",
"has_allergy",
"as",
"t2",
"on",
"t1",
".",
"stuid",
"=",
"t2",
".",
"stuid",
"where",
"t2",
".",
"allergy",
"=",
"value",
"or",
"t2",
".",
"allergy",
"=",
"value"
] |
[
"What",
"are",
"the",
"distinct",
"first",
"names",
"and",
"cities",
"of",
"the",
"students",
"who",
"have",
"allergy",
"either",
"to",
"milk",
"or",
"to",
"cat",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Find the number of students who are older than 18 and do not have allergy to either food or animal.
|
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")
|
[
"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",
"''",
")"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"student",
"where",
"age",
">",
"value",
"and",
"stuid",
"not",
"in",
"(",
"select",
"stuid",
"from",
"has_allergy",
"as",
"t1",
"join",
"allergy_type",
"as",
"t2",
"on",
"t1",
".",
"allergy",
"=",
"t2",
".",
"allergy",
"where",
"t2",
".",
"allergytype",
"=",
"value",
"or",
"t2",
".",
"allergytype",
"=",
"value",
")"
] |
[
"Find",
"the",
"number",
"of",
"students",
"who",
"are",
"older",
"than",
"18",
"and",
"do",
"not",
"have",
"allergy",
"to",
"either",
"food",
"or",
"animal",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
How many students are over 18 and do not have allergy to food type or animal type?
|
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")
|
[
"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",
"''",
")"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"student",
"where",
"age",
">",
"value",
"and",
"stuid",
"not",
"in",
"(",
"select",
"stuid",
"from",
"has_allergy",
"as",
"t1",
"join",
"allergy_type",
"as",
"t2",
"on",
"t1",
".",
"allergy",
"=",
"t2",
".",
"allergy",
"where",
"t2",
".",
"allergytype",
"=",
"value",
"or",
"t2",
".",
"allergytype",
"=",
"value",
")"
] |
[
"How",
"many",
"students",
"are",
"over",
"18",
"and",
"do",
"not",
"have",
"allergy",
"to",
"food",
"type",
"or",
"animal",
"type",
"?"
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
Find the first name and major of the students who are not allegry to soy.
|
SELECT fname , major FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Soy")
|
[
"SELECT",
"fname",
",",
"major",
"FROM",
"Student",
"WHERE",
"StuID",
"NOT",
"IN",
"(",
"SELECT",
"StuID",
"FROM",
"Has_allergy",
"WHERE",
"Allergy",
"=",
"``",
"Soy",
"''",
")"
] |
[
"select",
"fname",
",",
"major",
"from",
"student",
"where",
"stuid",
"not",
"in",
"(",
"select",
"stuid",
"from",
"has_allergy",
"where",
"allergy",
"=",
"value",
")"
] |
[
"Find",
"the",
"first",
"name",
"and",
"major",
"of",
"the",
"students",
"who",
"are",
"not",
"allegry",
"to",
"soy",
"."
] |
allergy_1
|
[
"create table Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);",
"create table Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);",
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"
] |
What are the first name and major of the students who are able to consume soy?
|
SELECT fname , major FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Soy")
|
[
"SELECT",
"fname",
",",
"major",
"FROM",
"Student",
"WHERE",
"StuID",
"NOT",
"IN",
"(",
"SELECT",
"StuID",
"FROM",
"Has_allergy",
"WHERE",
"Allergy",
"=",
"``",
"Soy",
"''",
")"
] |
[
"select",
"fname",
",",
"major",
"from",
"student",
"where",
"stuid",
"not",
"in",
"(",
"select",
"stuid",
"from",
"has_allergy",
"where",
"allergy",
"=",
"value",
")"
] |
[
"What",
"are",
"the",
"first",
"name",
"and",
"major",
"of",
"the",
"students",
"who",
"are",
"able",
"to",
"consume",
"soy",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
A list of the top 5 countries by number of invoices. List country name and number of invoices.
|
SELECT billing_country , COUNT(*) FROM invoices GROUP BY billing_country ORDER BY count(*) DESC LIMIT 5;
|
[
"SELECT",
"billing_country",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"invoices",
"GROUP",
"BY",
"billing_country",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"5",
";"
] |
[
"select",
"billing_country",
",",
"count",
"(",
"*",
")",
"from",
"invoices",
"group",
"by",
"billing_country",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"A",
"list",
"of",
"the",
"top",
"5",
"countries",
"by",
"number",
"of",
"invoices",
".",
"List",
"country",
"name",
"and",
"number",
"of",
"invoices",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What are the top 5 countries by number of invoices and how many do they have?
|
SELECT billing_country , COUNT(*) FROM invoices GROUP BY billing_country ORDER BY count(*) DESC LIMIT 5;
|
[
"SELECT",
"billing_country",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"invoices",
"GROUP",
"BY",
"billing_country",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"5",
";"
] |
[
"select",
"billing_country",
",",
"count",
"(",
"*",
")",
"from",
"invoices",
"group",
"by",
"billing_country",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"What",
"are",
"the",
"top",
"5",
"countries",
"by",
"number",
"of",
"invoices",
"and",
"how",
"many",
"do",
"they",
"have",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
A list of the top 8 countries by gross/total invoice size. List country name and gross invoice size.
|
SELECT billing_country , SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8;
|
[
"SELECT",
"billing_country",
",",
"SUM",
"(",
"total",
")",
"FROM",
"invoices",
"GROUP",
"BY",
"billing_country",
"ORDER",
"BY",
"SUM",
"(",
"total",
")",
"DESC",
"LIMIT",
"8",
";"
] |
[
"select",
"billing_country",
",",
"sum",
"(",
"total",
")",
"from",
"invoices",
"group",
"by",
"billing_country",
"order",
"by",
"sum",
"(",
"total",
")",
"desc",
"limit",
"value"
] |
[
"A",
"list",
"of",
"the",
"top",
"8",
"countries",
"by",
"gross/total",
"invoice",
"size",
".",
"List",
"country",
"name",
"and",
"gross",
"invoice",
"size",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What are the names of the top 8 countries by total invoice size and what are those sizes?
|
SELECT billing_country , SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8;
|
[
"SELECT",
"billing_country",
",",
"SUM",
"(",
"total",
")",
"FROM",
"invoices",
"GROUP",
"BY",
"billing_country",
"ORDER",
"BY",
"SUM",
"(",
"total",
")",
"DESC",
"LIMIT",
"8",
";"
] |
[
"select",
"billing_country",
",",
"sum",
"(",
"total",
")",
"from",
"invoices",
"group",
"by",
"billing_country",
"order",
"by",
"sum",
"(",
"total",
")",
"desc",
"limit",
"value"
] |
[
"What",
"are",
"the",
"names",
"of",
"the",
"top",
"8",
"countries",
"by",
"total",
"invoice",
"size",
"and",
"what",
"are",
"those",
"sizes",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
A list of the top 10 countries by average invoice size. List country name and average invoice size.
|
SELECT billing_country , AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10;
|
[
"SELECT",
"billing_country",
",",
"AVG",
"(",
"total",
")",
"FROM",
"invoices",
"GROUP",
"BY",
"billing_country",
"ORDER",
"BY",
"AVG",
"(",
"total",
")",
"DESC",
"LIMIT",
"10",
";"
] |
[
"select",
"billing_country",
",",
"avg",
"(",
"total",
")",
"from",
"invoices",
"group",
"by",
"billing_country",
"order",
"by",
"avg",
"(",
"total",
")",
"desc",
"limit",
"value"
] |
[
"A",
"list",
"of",
"the",
"top",
"10",
"countries",
"by",
"average",
"invoice",
"size",
".",
"List",
"country",
"name",
"and",
"average",
"invoice",
"size",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What are the names of the countries and average invoice size of the top countries by size?
|
SELECT billing_country , AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10;
|
[
"SELECT",
"billing_country",
",",
"AVG",
"(",
"total",
")",
"FROM",
"invoices",
"GROUP",
"BY",
"billing_country",
"ORDER",
"BY",
"AVG",
"(",
"total",
")",
"DESC",
"LIMIT",
"10",
";"
] |
[
"select",
"billing_country",
",",
"avg",
"(",
"total",
")",
"from",
"invoices",
"group",
"by",
"billing_country",
"order",
"by",
"avg",
"(",
"total",
")",
"desc",
"limit",
"value"
] |
[
"What",
"are",
"the",
"names",
"of",
"the",
"countries",
"and",
"average",
"invoice",
"size",
"of",
"the",
"top",
"countries",
"by",
"size",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
Find out 5 customers who most recently purchased something. List customers' first and last name.
|
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;
|
[
"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",
";"
] |
[
"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",
"value"
] |
[
"Find",
"out",
"5",
"customers",
"who",
"most",
"recently",
"purchased",
"something",
".",
"List",
"customers",
"'",
"first",
"and",
"last",
"name",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What are the first and last names of the 5 customers who purchased something most recently?
|
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;
|
[
"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",
";"
] |
[
"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",
"value"
] |
[
"What",
"are",
"the",
"first",
"and",
"last",
"names",
"of",
"the",
"5",
"customers",
"who",
"purchased",
"something",
"most",
"recently",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
Find out the top 10 customers by total number of orders. List customers' first and last name and the number of total orders.
|
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;
|
[
"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",
";"
] |
[
"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",
"value"
] |
[
"Find",
"out",
"the",
"top",
"10",
"customers",
"by",
"total",
"number",
"of",
"orders",
".",
"List",
"customers",
"'",
"first",
"and",
"last",
"name",
"and",
"the",
"number",
"of",
"total",
"orders",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What are the top 10 customers' first and last names by total number of orders and how many orders did they make?
|
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;
|
[
"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",
";"
] |
[
"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",
"value"
] |
[
"What",
"are",
"the",
"top",
"10",
"customers",
"'",
"first",
"and",
"last",
"names",
"by",
"total",
"number",
"of",
"orders",
"and",
"how",
"many",
"orders",
"did",
"they",
"make",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
List the top 10 customers by total gross sales. List customers' first and last name and total gross sales.
|
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;
|
[
"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",
";"
] |
[
"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",
"value"
] |
[
"List",
"the",
"top",
"10",
"customers",
"by",
"total",
"gross",
"sales",
".",
"List",
"customers",
"'",
"first",
"and",
"last",
"name",
"and",
"total",
"gross",
"sales",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What are the top 10 customers' first and last names with the highest gross sales, and also what are the sales?
|
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;
|
[
"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",
";"
] |
[
"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",
"value"
] |
[
"What",
"are",
"the",
"top",
"10",
"customers",
"'",
"first",
"and",
"last",
"names",
"with",
"the",
"highest",
"gross",
"sales",
",",
"and",
"also",
"what",
"are",
"the",
"sales",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
List the top 5 genres by number of tracks. List genres name and total tracks.
|
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;
|
[
"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",
";"
] |
[
"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",
"value"
] |
[
"List",
"the",
"top",
"5",
"genres",
"by",
"number",
"of",
"tracks",
".",
"List",
"genres",
"name",
"and",
"total",
"tracks",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
How many tracks does each genre have and what are the names of the top 5?
|
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;
|
[
"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",
";"
] |
[
"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",
"value"
] |
[
"How",
"many",
"tracks",
"does",
"each",
"genre",
"have",
"and",
"what",
"are",
"the",
"names",
"of",
"the",
"top",
"5",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
List every album's title.
|
SELECT title FROM albums;
|
[
"SELECT",
"title",
"FROM",
"albums",
";"
] |
[
"select",
"title",
"from",
"albums"
] |
[
"List",
"every",
"album",
"'s",
"title",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What are the titles of all the albums?
|
SELECT title FROM albums;
|
[
"SELECT",
"title",
"FROM",
"albums",
";"
] |
[
"select",
"title",
"from",
"albums"
] |
[
"What",
"are",
"the",
"titles",
"of",
"all",
"the",
"albums",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
List every album ordered by album title in ascending order.
|
SELECT title FROM albums ORDER BY title;
|
[
"SELECT",
"title",
"FROM",
"albums",
"ORDER",
"BY",
"title",
";"
] |
[
"select",
"title",
"from",
"albums",
"order",
"by",
"title"
] |
[
"List",
"every",
"album",
"ordered",
"by",
"album",
"title",
"in",
"ascending",
"order",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What are the titles of all the albums alphabetically ascending?
|
SELECT title FROM albums ORDER BY title;
|
[
"SELECT",
"title",
"FROM",
"albums",
"ORDER",
"BY",
"title",
";"
] |
[
"select",
"title",
"from",
"albums",
"order",
"by",
"title"
] |
[
"What",
"are",
"the",
"titles",
"of",
"all",
"the",
"albums",
"alphabetically",
"ascending",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
List every album whose title starts with A in alphabetical order.
|
SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title;
|
[
"SELECT",
"title",
"FROM",
"albums",
"WHERE",
"title",
"LIKE",
"'A",
"%",
"'",
"ORDER",
"BY",
"title",
";"
] |
[
"select",
"title",
"from",
"albums",
"where",
"title",
"like",
"value",
"order",
"by",
"title"
] |
[
"List",
"every",
"album",
"whose",
"title",
"starts",
"with",
"A",
"in",
"alphabetical",
"order",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What are the titles of all albums that start with A in alphabetical order?
|
SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title;
|
[
"SELECT",
"title",
"FROM",
"albums",
"WHERE",
"title",
"LIKE",
"'A",
"%",
"'",
"ORDER",
"BY",
"title",
";"
] |
[
"select",
"title",
"from",
"albums",
"where",
"title",
"like",
"value",
"order",
"by",
"title"
] |
[
"What",
"are",
"the",
"titles",
"of",
"all",
"albums",
"that",
"start",
"with",
"A",
"in",
"alphabetical",
"order",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
List the customers first and last name of 10 least expensive invoices.
|
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;
|
[
"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",
";"
] |
[
"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",
"value"
] |
[
"List",
"the",
"customers",
"first",
"and",
"last",
"name",
"of",
"10",
"least",
"expensive",
"invoices",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What are the first and last names of the customers with the 10 cheapest invoices?
|
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;
|
[
"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",
";"
] |
[
"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",
"value"
] |
[
"What",
"are",
"the",
"first",
"and",
"last",
"names",
"of",
"the",
"customers",
"with",
"the",
"10",
"cheapest",
"invoices",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
List total amount of invoice from Chicago, IL.
|
SELECT sum(total) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL";
|
[
"SELECT",
"sum",
"(",
"total",
")",
"FROM",
"invoices",
"WHERE",
"billing_city",
"=",
"``",
"Chicago",
"''",
"AND",
"billing_state",
"=",
"``",
"IL",
"''",
";"
] |
[
"select",
"sum",
"(",
"total",
")",
"from",
"invoices",
"where",
"billing_city",
"=",
"value",
"and",
"billing_state",
"=",
"value"
] |
[
"List",
"total",
"amount",
"of",
"invoice",
"from",
"Chicago",
",",
"IL",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What are the total amount of money in the invoices billed from Chicago, Illinois?
|
SELECT sum(total) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL";
|
[
"SELECT",
"sum",
"(",
"total",
")",
"FROM",
"invoices",
"WHERE",
"billing_city",
"=",
"``",
"Chicago",
"''",
"AND",
"billing_state",
"=",
"``",
"IL",
"''",
";"
] |
[
"select",
"sum",
"(",
"total",
")",
"from",
"invoices",
"where",
"billing_city",
"=",
"value",
"and",
"billing_state",
"=",
"value"
] |
[
"What",
"are",
"the",
"total",
"amount",
"of",
"money",
"in",
"the",
"invoices",
"billed",
"from",
"Chicago",
",",
"Illinois",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
List the number of invoices from Chicago, IL.
|
SELECT COUNT(*) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL";
|
[
"SELECT",
"COUNT",
"(",
"*",
")",
"FROM",
"invoices",
"WHERE",
"billing_city",
"=",
"``",
"Chicago",
"''",
"AND",
"billing_state",
"=",
"``",
"IL",
"''",
";"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"invoices",
"where",
"billing_city",
"=",
"value",
"and",
"billing_state",
"=",
"value"
] |
[
"List",
"the",
"number",
"of",
"invoices",
"from",
"Chicago",
",",
"IL",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
How many invoices were billed from Chicago, IL?
|
SELECT COUNT(*) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL";
|
[
"SELECT",
"COUNT",
"(",
"*",
")",
"FROM",
"invoices",
"WHERE",
"billing_city",
"=",
"``",
"Chicago",
"''",
"AND",
"billing_state",
"=",
"``",
"IL",
"''",
";"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"invoices",
"where",
"billing_city",
"=",
"value",
"and",
"billing_state",
"=",
"value"
] |
[
"How",
"many",
"invoices",
"were",
"billed",
"from",
"Chicago",
",",
"IL",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
List the number of invoices from the US, grouped by state.
|
SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state;
|
[
"SELECT",
"billing_state",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"invoices",
"WHERE",
"billing_country",
"=",
"``",
"USA",
"''",
"GROUP",
"BY",
"billing_state",
";"
] |
[
"select",
"billing_state",
",",
"count",
"(",
"*",
")",
"from",
"invoices",
"where",
"billing_country",
"=",
"value",
"group",
"by",
"billing_state"
] |
[
"List",
"the",
"number",
"of",
"invoices",
"from",
"the",
"US",
",",
"grouped",
"by",
"state",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
How many invoices were billed from each state?
|
SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state;
|
[
"SELECT",
"billing_state",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"invoices",
"WHERE",
"billing_country",
"=",
"``",
"USA",
"''",
"GROUP",
"BY",
"billing_state",
";"
] |
[
"select",
"billing_state",
",",
"count",
"(",
"*",
")",
"from",
"invoices",
"where",
"billing_country",
"=",
"value",
"group",
"by",
"billing_state"
] |
[
"How",
"many",
"invoices",
"were",
"billed",
"from",
"each",
"state",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
List the state in the US with the most invoices.
|
SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1;
|
[
"SELECT",
"billing_state",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"invoices",
"WHERE",
"billing_country",
"=",
"``",
"USA",
"''",
"GROUP",
"BY",
"billing_state",
"ORDER",
"BY",
"COUNT",
"(",
"*",
")",
"DESC",
"LIMIT",
"1",
";"
] |
[
"select",
"billing_state",
",",
"count",
"(",
"*",
")",
"from",
"invoices",
"where",
"billing_country",
"=",
"value",
"group",
"by",
"billing_state",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"List",
"the",
"state",
"in",
"the",
"US",
"with",
"the",
"most",
"invoices",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What are the states with the most invoices?
|
SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1;
|
[
"SELECT",
"billing_state",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"invoices",
"WHERE",
"billing_country",
"=",
"``",
"USA",
"''",
"GROUP",
"BY",
"billing_state",
"ORDER",
"BY",
"COUNT",
"(",
"*",
")",
"DESC",
"LIMIT",
"1",
";"
] |
[
"select",
"billing_state",
",",
"count",
"(",
"*",
")",
"from",
"invoices",
"where",
"billing_country",
"=",
"value",
"group",
"by",
"billing_state",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"What",
"are",
"the",
"states",
"with",
"the",
"most",
"invoices",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
List the number of invoices and the invoice total from California.
|
SELECT billing_state , COUNT(*) , SUM(total) FROM invoices WHERE billing_state = "CA";
|
[
"SELECT",
"billing_state",
",",
"COUNT",
"(",
"*",
")",
",",
"SUM",
"(",
"total",
")",
"FROM",
"invoices",
"WHERE",
"billing_state",
"=",
"``",
"CA",
"''",
";"
] |
[
"select",
"billing_state",
",",
"count",
"(",
"*",
")",
",",
"sum",
"(",
"total",
")",
"from",
"invoices",
"where",
"billing_state",
"=",
"value"
] |
[
"List",
"the",
"number",
"of",
"invoices",
"and",
"the",
"invoice",
"total",
"from",
"California",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What is the number of invoices and total money billed in them from CA?
|
SELECT billing_state , COUNT(*) , SUM(total) FROM invoices WHERE billing_state = "CA";
|
[
"SELECT",
"billing_state",
",",
"COUNT",
"(",
"*",
")",
",",
"SUM",
"(",
"total",
")",
"FROM",
"invoices",
"WHERE",
"billing_state",
"=",
"``",
"CA",
"''",
";"
] |
[
"select",
"billing_state",
",",
"count",
"(",
"*",
")",
",",
"sum",
"(",
"total",
")",
"from",
"invoices",
"where",
"billing_state",
"=",
"value"
] |
[
"What",
"is",
"the",
"number",
"of",
"invoices",
"and",
"total",
"money",
"billed",
"in",
"them",
"from",
"CA",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
List Aerosmith's albums.
|
SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Aerosmith";
|
[
"SELECT",
"T1.title",
"FROM",
"albums",
"AS",
"T1",
"JOIN",
"artists",
"AS",
"T2",
"ON",
"T1.artist_id",
"=",
"T2.id",
"WHERE",
"T2.name",
"=",
"``",
"Aerosmith",
"''",
";"
] |
[
"select",
"t1",
".",
"title",
"from",
"albums",
"as",
"t1",
"join",
"artists",
"as",
"t2",
"on",
"t1",
".",
"artist_id",
"=",
"t2",
".",
"id",
"where",
"t2",
".",
"name",
"=",
"value"
] |
[
"List",
"Aerosmith",
"'s",
"albums",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What are the titles of all the Aerosmith albums?
|
SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Aerosmith";
|
[
"SELECT",
"T1.title",
"FROM",
"albums",
"AS",
"T1",
"JOIN",
"artists",
"AS",
"T2",
"ON",
"T1.artist_id",
"=",
"T2.id",
"WHERE",
"T2.name",
"=",
"``",
"Aerosmith",
"''",
";"
] |
[
"select",
"t1",
".",
"title",
"from",
"albums",
"as",
"t1",
"join",
"artists",
"as",
"t2",
"on",
"t1",
".",
"artist_id",
"=",
"t2",
".",
"id",
"where",
"t2",
".",
"name",
"=",
"value"
] |
[
"What",
"are",
"the",
"titles",
"of",
"all",
"the",
"Aerosmith",
"albums",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
How many albums does Billy Cobham has?
|
SELECT count(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Billy Cobham";
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"albums",
"AS",
"T1",
"JOIN",
"artists",
"AS",
"T2",
"ON",
"T1.artist_id",
"=",
"T2.id",
"WHERE",
"T2.name",
"=",
"``",
"Billy",
"Cobham",
"''",
";"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"albums",
"as",
"t1",
"join",
"artists",
"as",
"t2",
"on",
"t1",
".",
"artist_id",
"=",
"t2",
".",
"id",
"where",
"t2",
".",
"name",
"=",
"value"
] |
[
"How",
"many",
"albums",
"does",
"Billy",
"Cobham",
"has",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
How many albums has Billy Cobam released?
|
SELECT count(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Billy Cobham";
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"albums",
"AS",
"T1",
"JOIN",
"artists",
"AS",
"T2",
"ON",
"T1.artist_id",
"=",
"T2.id",
"WHERE",
"T2.name",
"=",
"``",
"Billy",
"Cobham",
"''",
";"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"albums",
"as",
"t1",
"join",
"artists",
"as",
"t2",
"on",
"t1",
".",
"artist_id",
"=",
"t2",
".",
"id",
"where",
"t2",
".",
"name",
"=",
"value"
] |
[
"How",
"many",
"albums",
"has",
"Billy",
"Cobam",
"released",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
Eduardo Martins is a customer at which company?
|
SELECT company FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins";
|
[
"SELECT",
"company",
"FROM",
"customers",
"WHERE",
"first_name",
"=",
"``",
"Eduardo",
"''",
"AND",
"last_name",
"=",
"``",
"Martins",
"''",
";"
] |
[
"select",
"company",
"from",
"customers",
"where",
"first_name",
"=",
"value",
"and",
"last_name",
"=",
"value"
] |
[
"Eduardo",
"Martins",
"is",
"a",
"customer",
"at",
"which",
"company",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What is the company where Eduardo Martins is a customer?
|
SELECT company FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins";
|
[
"SELECT",
"company",
"FROM",
"customers",
"WHERE",
"first_name",
"=",
"``",
"Eduardo",
"''",
"AND",
"last_name",
"=",
"``",
"Martins",
"''",
";"
] |
[
"select",
"company",
"from",
"customers",
"where",
"first_name",
"=",
"value",
"and",
"last_name",
"=",
"value"
] |
[
"What",
"is",
"the",
"company",
"where",
"Eduardo",
"Martins",
"is",
"a",
"customer",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What is Astrid Gruber's email and phone number?
|
SELECT email , phone FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber";
|
[
"SELECT",
"email",
",",
"phone",
"FROM",
"customers",
"WHERE",
"first_name",
"=",
"``",
"Astrid",
"''",
"AND",
"last_name",
"=",
"``",
"Gruber",
"''",
";"
] |
[
"select",
"email",
",",
"phone",
"from",
"customers",
"where",
"first_name",
"=",
"value",
"and",
"last_name",
"=",
"value"
] |
[
"What",
"is",
"Astrid",
"Gruber",
"'s",
"email",
"and",
"phone",
"number",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What is the email and phone number of Astrid Gruber the customer?
|
SELECT email , phone FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber";
|
[
"SELECT",
"email",
",",
"phone",
"FROM",
"customers",
"WHERE",
"first_name",
"=",
"``",
"Astrid",
"''",
"AND",
"last_name",
"=",
"``",
"Gruber",
"''",
";"
] |
[
"select",
"email",
",",
"phone",
"from",
"customers",
"where",
"first_name",
"=",
"value",
"and",
"last_name",
"=",
"value"
] |
[
"What",
"is",
"the",
"email",
"and",
"phone",
"number",
"of",
"Astrid",
"Gruber",
"the",
"customer",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
How many customers live in Prague city?
|
SELECT count(*) FROM customers WHERE city = "Prague";
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"customers",
"WHERE",
"city",
"=",
"``",
"Prague",
"''",
";"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"customers",
"where",
"city",
"=",
"value"
] |
[
"How",
"many",
"customers",
"live",
"in",
"Prague",
"city",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
How many customers live in the city of Prague?
|
SELECT count(*) FROM customers WHERE city = "Prague";
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"customers",
"WHERE",
"city",
"=",
"``",
"Prague",
"''",
";"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"customers",
"where",
"city",
"=",
"value"
] |
[
"How",
"many",
"customers",
"live",
"in",
"the",
"city",
"of",
"Prague",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
How many customers in state of CA?
|
SELECT count(*) FROM customers WHERE state = "CA";
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"customers",
"WHERE",
"state",
"=",
"``",
"CA",
"''",
";"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"customers",
"where",
"state",
"=",
"value"
] |
[
"How",
"many",
"customers",
"in",
"state",
"of",
"CA",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
How many customers are from California?
|
SELECT count(*) FROM customers WHERE state = "CA";
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"customers",
"WHERE",
"state",
"=",
"``",
"CA",
"''",
";"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"customers",
"where",
"state",
"=",
"value"
] |
[
"How",
"many",
"customers",
"are",
"from",
"California",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What country does Roberto Almeida live?
|
SELECT country FROM customers WHERE first_name = "Roberto" AND last_name = "Almeida";
|
[
"SELECT",
"country",
"FROM",
"customers",
"WHERE",
"first_name",
"=",
"``",
"Roberto",
"''",
"AND",
"last_name",
"=",
"``",
"Almeida",
"''",
";"
] |
[
"select",
"country",
"from",
"customers",
"where",
"first_name",
"=",
"value",
"and",
"last_name",
"=",
"value"
] |
[
"What",
"country",
"does",
"Roberto",
"Almeida",
"live",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
In which country does Roberto Almeida?
|
SELECT country FROM customers WHERE first_name = "Roberto" AND last_name = "Almeida";
|
[
"SELECT",
"country",
"FROM",
"customers",
"WHERE",
"first_name",
"=",
"``",
"Roberto",
"''",
"AND",
"last_name",
"=",
"``",
"Almeida",
"''",
";"
] |
[
"select",
"country",
"from",
"customers",
"where",
"first_name",
"=",
"value",
"and",
"last_name",
"=",
"value"
] |
[
"In",
"which",
"country",
"does",
"Roberto",
"Almeida",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
List the name of albums that are released by aritist whose name has 'Led'
|
SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'
|
[
"SELECT",
"T2.title",
"FROM",
"artists",
"AS",
"T1",
"JOIN",
"albums",
"AS",
"T2",
"ON",
"T1.id",
"=",
"T2.artist_id",
"WHERE",
"T1.name",
"LIKE",
"'",
"%",
"Led",
"%",
"'"
] |
[
"select",
"t2",
".",
"title",
"from",
"artists",
"as",
"t1",
"join",
"albums",
"as",
"t2",
"on",
"t1",
".",
"id",
"=",
"t2",
".",
"artist_id",
"where",
"t1",
".",
"name",
"like",
"value"
] |
[
"List",
"the",
"name",
"of",
"albums",
"that",
"are",
"released",
"by",
"aritist",
"whose",
"name",
"has",
"'Led",
"'"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What is the title of the album that was released by the artist whose name has the phrase 'Led'?
|
SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'
|
[
"SELECT",
"T2.title",
"FROM",
"artists",
"AS",
"T1",
"JOIN",
"albums",
"AS",
"T2",
"ON",
"T1.id",
"=",
"T2.artist_id",
"WHERE",
"T1.name",
"LIKE",
"'",
"%",
"Led",
"%",
"'"
] |
[
"select",
"t2",
".",
"title",
"from",
"artists",
"as",
"t1",
"join",
"albums",
"as",
"t2",
"on",
"t1",
".",
"id",
"=",
"t2",
".",
"artist_id",
"where",
"t1",
".",
"name",
"like",
"value"
] |
[
"What",
"is",
"the",
"title",
"of",
"the",
"album",
"that",
"was",
"released",
"by",
"the",
"artist",
"whose",
"name",
"has",
"the",
"phrase",
"'Led",
"'",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
How many customers does Steve Johnson support?
|
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";
|
[
"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",
"''",
";"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"employees",
"as",
"t1",
"join",
"customers",
"as",
"t2",
"on",
"t2",
".",
"support_rep_id",
"=",
"t1",
".",
"id",
"where",
"t1",
".",
"first_name",
"=",
"value",
"and",
"t1",
".",
"last_name",
"=",
"value"
] |
[
"How",
"many",
"customers",
"does",
"Steve",
"Johnson",
"support",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What is the count of customers that Steve Johnson supports?
|
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";
|
[
"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",
"''",
";"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"employees",
"as",
"t1",
"join",
"customers",
"as",
"t2",
"on",
"t2",
".",
"support_rep_id",
"=",
"t1",
".",
"id",
"where",
"t1",
".",
"first_name",
"=",
"value",
"and",
"t1",
".",
"last_name",
"=",
"value"
] |
[
"What",
"is",
"the",
"count",
"of",
"customers",
"that",
"Steve",
"Johnson",
"supports",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What is the title, phone and hire date of Nancy Edwards?
|
SELECT title , phone , hire_date FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
|
[
"SELECT",
"title",
",",
"phone",
",",
"hire_date",
"FROM",
"employees",
"WHERE",
"first_name",
"=",
"``",
"Nancy",
"''",
"AND",
"last_name",
"=",
"``",
"Edwards",
"''",
";"
] |
[
"select",
"title",
",",
"phone",
",",
"hire_date",
"from",
"employees",
"where",
"first_name",
"=",
"value",
"and",
"last_name",
"=",
"value"
] |
[
"What",
"is",
"the",
"title",
",",
"phone",
"and",
"hire",
"date",
"of",
"Nancy",
"Edwards",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What is the title, phone number and hire date for the employee named Nancy Edwards?
|
SELECT title , phone , hire_date FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
|
[
"SELECT",
"title",
",",
"phone",
",",
"hire_date",
"FROM",
"employees",
"WHERE",
"first_name",
"=",
"``",
"Nancy",
"''",
"AND",
"last_name",
"=",
"``",
"Edwards",
"''",
";"
] |
[
"select",
"title",
",",
"phone",
",",
"hire_date",
"from",
"employees",
"where",
"first_name",
"=",
"value",
"and",
"last_name",
"=",
"value"
] |
[
"What",
"is",
"the",
"title",
",",
"phone",
"number",
"and",
"hire",
"date",
"for",
"the",
"employee",
"named",
"Nancy",
"Edwards",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
find the full name of employees who report to Nancy Edwards?
|
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";
|
[
"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",
"''",
";"
] |
[
"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",
"=",
"value",
"and",
"t1",
".",
"last_name",
"=",
"value"
] |
[
"find",
"the",
"full",
"name",
"of",
"employees",
"who",
"report",
"to",
"Nancy",
"Edwards",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What is the first and last name of the employee who reports to Nancy Edwards?
|
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";
|
[
"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",
"''",
";"
] |
[
"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",
"=",
"value",
"and",
"t1",
".",
"last_name",
"=",
"value"
] |
[
"What",
"is",
"the",
"first",
"and",
"last",
"name",
"of",
"the",
"employee",
"who",
"reports",
"to",
"Nancy",
"Edwards",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What is the address of employee Nancy Edwards?
|
SELECT address FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
|
[
"SELECT",
"address",
"FROM",
"employees",
"WHERE",
"first_name",
"=",
"``",
"Nancy",
"''",
"AND",
"last_name",
"=",
"``",
"Edwards",
"''",
";"
] |
[
"select",
"address",
"from",
"employees",
"where",
"first_name",
"=",
"value",
"and",
"last_name",
"=",
"value"
] |
[
"What",
"is",
"the",
"address",
"of",
"employee",
"Nancy",
"Edwards",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What is Nancy Edwards's address?
|
SELECT address FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
|
[
"SELECT",
"address",
"FROM",
"employees",
"WHERE",
"first_name",
"=",
"``",
"Nancy",
"''",
"AND",
"last_name",
"=",
"``",
"Edwards",
"''",
";"
] |
[
"select",
"address",
"from",
"employees",
"where",
"first_name",
"=",
"value",
"and",
"last_name",
"=",
"value"
] |
[
"What",
"is",
"Nancy",
"Edwards",
"'s",
"address",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
Find the full name of employee who supported the most number of customers.
|
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
|
[
"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"
] |
[
"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",
"value"
] |
[
"Find",
"the",
"full",
"name",
"of",
"employee",
"who",
"supported",
"the",
"most",
"number",
"of",
"customers",
"."
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What is the full name of the employee who has the most customers?
|
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
|
[
"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"
] |
[
"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",
"value"
] |
[
"What",
"is",
"the",
"full",
"name",
"of",
"the",
"employee",
"who",
"has",
"the",
"most",
"customers",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
How many employees are living in Canada?
|
SELECT count(*) FROM employees WHERE country = "Canada";
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"employees",
"WHERE",
"country",
"=",
"``",
"Canada",
"''",
";"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"employees",
"where",
"country",
"=",
"value"
] |
[
"How",
"many",
"employees",
"are",
"living",
"in",
"Canada",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
How many employees live in Canada?
|
SELECT count(*) FROM employees WHERE country = "Canada";
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"employees",
"WHERE",
"country",
"=",
"``",
"Canada",
"''",
";"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"employees",
"where",
"country",
"=",
"value"
] |
[
"How",
"many",
"employees",
"live",
"in",
"Canada",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What is employee Nancy Edwards's phone number?
|
SELECT phone FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
|
[
"SELECT",
"phone",
"FROM",
"employees",
"WHERE",
"first_name",
"=",
"``",
"Nancy",
"''",
"AND",
"last_name",
"=",
"``",
"Edwards",
"''",
";"
] |
[
"select",
"phone",
"from",
"employees",
"where",
"first_name",
"=",
"value",
"and",
"last_name",
"=",
"value"
] |
[
"What",
"is",
"employee",
"Nancy",
"Edwards",
"'s",
"phone",
"number",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
What is the the phone number of Nancy Edwards?
|
SELECT phone FROM employees WHERE first_name = "Nancy" AND last_name = "Edwards";
|
[
"SELECT",
"phone",
"FROM",
"employees",
"WHERE",
"first_name",
"=",
"``",
"Nancy",
"''",
"AND",
"last_name",
"=",
"``",
"Edwards",
"''",
";"
] |
[
"select",
"phone",
"from",
"employees",
"where",
"first_name",
"=",
"value",
"and",
"last_name",
"=",
"value"
] |
[
"What",
"is",
"the",
"the",
"phone",
"number",
"of",
"Nancy",
"Edwards",
"?"
] |
store_1
|
[
"Create Tables\n********************************************************************************/\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);",
"CREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);",
"CREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"
] |
Who is the youngest employee in the company? List employee's first and last name.
|
SELECT first_name , last_name FROM employees ORDER BY birth_date DESC LIMIT 1;
|
[
"SELECT",
"first_name",
",",
"last_name",
"FROM",
"employees",
"ORDER",
"BY",
"birth_date",
"DESC",
"LIMIT",
"1",
";"
] |
[
"select",
"first_name",
",",
"last_name",
"from",
"employees",
"order",
"by",
"birth_date",
"desc",
"limit",
"value"
] |
[
"Who",
"is",
"the",
"youngest",
"employee",
"in",
"the",
"company",
"?",
"List",
"employee",
"'s",
"first",
"and",
"last",
"name",
"."
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.