Search is not available for this dataset
db_id
stringlengths
3
31
query
stringlengths
20
523
question
stringlengths
3
224
schema
stringlengths
589
322M
query_res
stringlengths
0
363k
shop_membership
SELECT T2.name , count(*) FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year > 2015 GROUP BY T2.branch_id
For each branch id, what are the names of the branches that were registered after 2015?
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
('Alexandre', 3) ('Popert', 1) ('Zytogorski', 1) ('Cochrane', 1) ('Taverner', 1) ('Brooke Greville', 1)
shop_membership
SELECT name FROM member WHERE member_id NOT IN (SELECT member_id FROM membership_register_branch)
Show member names without any registered branch.
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
('David Jones',) ('Matt Lentz',)
shop_membership
SELECT name FROM member WHERE member_id NOT IN (SELECT member_id FROM membership_register_branch)
What are the names of the members that have never registered at any branch?
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
('David Jones',) ('Matt Lentz',)
shop_membership
SELECT name , city FROM branch WHERE branch_id NOT IN (SELECT branch_id FROM membership_register_branch)
List the branch name and city without any registered members.
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
('Stanley', 'London') ('Saint Amant', 'London')
shop_membership
SELECT name , city FROM branch WHERE branch_id NOT IN (SELECT branch_id FROM membership_register_branch)
What are the names and cities of the branches that do not have any registered members?
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
('Stanley', 'London') ('Saint Amant', 'London')
shop_membership
SELECT T2.name , T2.open_year FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year = 2016 GROUP BY T2.branch_id ORDER BY count(*) DESC LIMIT 1
What is the name and open year for the branch with most number of memberships registered in 2016?
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
('Alexandre', '2001')
shop_membership
SELECT T2.name , T2.open_year FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year = 2016 GROUP BY T2.branch_id ORDER BY count(*) DESC LIMIT 1
What is the name and opening year for the branch that registered the most members in 2016?
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
('Alexandre', '2001')
shop_membership
SELECT T2.name , T2.hometown FROM membership_register_branch AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T1.register_year = 2016
Show the member name and hometown who registered a branch in 2016.
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
('Jeremy Jarmon', 'Collierville, Tennessee') ('Myron Pryor', 'Louisville, Kentucky') ('Ventrell Jenkins', 'Columbia, South Carolina') ('Braxton Kelley', 'LaGrange, Georgia') ('Johnny Williams', 'Jacksonville, Florida') ('Trevard Lindley', 'Hiram, Georgia')
shop_membership
SELECT T2.name , T2.hometown FROM membership_register_branch AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T1.register_year = 2016
What are the member names and hometowns of those who registered at a branch in 2016?
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
('Jeremy Jarmon', 'Collierville, Tennessee') ('Myron Pryor', 'Louisville, Kentucky') ('Ventrell Jenkins', 'Columbia, South Carolina') ('Braxton Kelley', 'LaGrange, Georgia') ('Johnny Williams', 'Jacksonville, Florida') ('Trevard Lindley', 'Hiram, Georgia')
shop_membership
SELECT city FROM branch WHERE open_year = 2001 AND membership_amount > 100
Show all city with a branch opened in 2001 and a branch with more than 100 membership.
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
('London',)
shop_membership
SELECT city FROM branch WHERE open_year = 2001 AND membership_amount > 100
What are the cities that have a branch that opened in 2001 and a branch with more than 100 members?
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
('London',)
shop_membership
SELECT city FROM branch EXCEPT SELECT city FROM branch WHERE membership_amount > 100
Show all cities without a branch having more than 100 memberships.
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
shop_membership
SELECT city FROM branch EXCEPT SELECT city FROM branch WHERE membership_amount > 100
What are the cities that do not have any branches with more than 100 members?
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
shop_membership
SELECT sum(total_pounds) FROM purchase AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T2.city = 'London' AND T1.year = 2018
What is the sum of total pounds of purchase in year 2018 for all branches in London?
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
(3531.5899999999997,)
shop_membership
SELECT sum(total_pounds) FROM purchase AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T2.city = 'London' AND T1.year = 2018
How many total pounds were purchased in the year 2018 at all London branches?
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
(3531.5899999999997,)
shop_membership
SELECT count(*) FROM purchase AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T2.level = 6
What is the total number of purchases for members with level 6?
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
(7,)
shop_membership
SELECT count(*) FROM purchase AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T2.level = 6
What are the total purchases for members rated at level 6?
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
(7,)
shop_membership
SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.Hometown = 'Louisville , Kentucky' INTERSECT SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN...
Find the name of branches where have some members whose hometown is in Louisville, Kentucky and some in Hiram, Georgia.
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
shop_membership
SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.Hometown = 'Louisville , Kentucky' INTERSECT SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN...
What are the names of the branches that have some members with a hometown in Louisville, Kentucky and also those from Hiram, Goergia?
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
shop_membership
SELECT card_number FROM member WHERE Hometown LIKE "%Kentucky%"
list the card number of all members whose hometown address includes word "Kentucky".
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
('LT98',) ('RT91',) ('MLB4',)
shop_membership
SELECT card_number FROM member WHERE Hometown LIKE "%Kentucky%"
What are the card numbers of members from Kentucky?
PRAGMA foreign_keys = ON; CREATE TABLE "member" ( "Member_ID" int, "Card_Number" text, "Name" text, "Hometown" text, "Level" int, PRIMARY KEY ("Member_ID") ); INSERT INTO "member" VALUES (1,"LE99","Jeremy Jarmon","Collierville, Tennessee","6"); INSERT INTO "member" VALUES (2,"LT98","Myron Pryor","Louisville, Kentu...
('LT98',) ('RT91',) ('MLB4',)
voter_2
SELECT count(*) FROM STUDENT
Find the number of students in total.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(34,)
voter_2
SELECT count(*) FROM STUDENT
How many students are there in total?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(34,)
voter_2
SELECT count(*) FROM VOTING_RECORD
Find the number of voting records in total.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(10,)
voter_2
SELECT count(*) FROM VOTING_RECORD
How many voting records do we have?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(10,)
voter_2
SELECT count(DISTINCT President_Vote) FROM VOTING_RECORD
Find the distinct number of president votes.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(3,)
voter_2
SELECT count(DISTINCT President_Vote) FROM VOTING_RECORD
How many distinct president votes are recorded?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(3,)
voter_2
SELECT max(Age) FROM STUDENT
Find the maximum age of all the students.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(27,)
voter_2
SELECT max(Age) FROM STUDENT
What is the oldest age among the students?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(27,)
voter_2
SELECT LName FROM STUDENT WHERE Major = 50
Find the last names of students with major 50.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Epp',) ('Schmidt',)
voter_2
SELECT LName FROM STUDENT WHERE Major = 50
What are the last names of students studying major 50?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Epp',) ('Schmidt',)
voter_2
SELECT Fname FROM STUDENT WHERE Age > 22
Find the first names of students with age above 22.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Paul',) ('Bruce',) ('Sarah',)
voter_2
SELECT Fname FROM STUDENT WHERE Age > 22
What are the first names of all the students aged above 22?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Paul',) ('Bruce',) ('Sarah',)
voter_2
SELECT Major FROM STUDENT WHERE Sex = "M"
What are the majors of male (sex is M) students?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(600,) (600,) (600,) (600,) (600,) (600,) (600,) (600,) (600,) (600,) (600,) (600,) (520,) (520,) (540,) (520,) (520,) (520,) (520,) (550,) (100,) (550,) (550,) (50,)
voter_2
SELECT Major FROM STUDENT WHERE Sex = "M"
List the major of each male student.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(600,) (600,) (600,) (600,) (600,) (600,) (600,) (600,) (600,) (600,) (600,) (600,) (520,) (520,) (540,) (520,) (520,) (520,) (520,) (550,) (100,) (550,) (550,) (50,)
voter_2
SELECT avg(Age) FROM STUDENT WHERE Sex = "F"
What is the average age of female (sex is F) students?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(19.7,)
voter_2
SELECT avg(Age) FROM STUDENT WHERE Sex = "F"
Find the average age of female students.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(19.7,)
voter_2
SELECT max(Age) , min(Age) FROM STUDENT WHERE Major = 600
What are the maximum and minimum age of students with major 600?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(27, 16)
voter_2
SELECT max(Age) , min(Age) FROM STUDENT WHERE Major = 600
Tell me the ages of the oldest and youngest students studying major 600.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(27, 16)
voter_2
SELECT Advisor FROM STUDENT WHERE city_code = "BAL"
Who are the advisors for students that live in a city with city code "BAL"?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(1121,) (1148,) (9172,) (7271,)
voter_2
SELECT Advisor FROM STUDENT WHERE city_code = "BAL"
Show the advisors of the students whose city of residence has city code "BAL".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(1121,) (1148,) (9172,) (7271,)
voter_2
SELECT DISTINCT Secretary_Vote FROM VOTING_RECORD WHERE ELECTION_CYCLE = "Fall"
What are the distinct secretary votes in the fall election cycle?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(1010,) (1020,)
voter_2
SELECT DISTINCT Secretary_Vote FROM VOTING_RECORD WHERE ELECTION_CYCLE = "Fall"
Return all the distinct secretary votes made in the fall election cycle.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(1010,) (1020,)
voter_2
SELECT DISTINCT PRESIDENT_Vote FROM VOTING_RECORD WHERE Registration_Date = "08/30/2015"
What are the distinct president votes on 08/30/2015?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(1004,)
voter_2
SELECT DISTINCT PRESIDENT_Vote FROM VOTING_RECORD WHERE Registration_Date = "08/30/2015"
Show all the distinct president votes made on 08/30/2015.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(1004,)
voter_2
SELECT DISTINCT Registration_Date , Election_Cycle FROM VOTING_RECORD
Report the distinct registration date and the election cycle.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('08/30/2015', 'Spring') ('08/30/2014', 'Spring') ('08/30/2013', 'Spring') ('08/30/2012', 'Spring') ('08/30/2015', 'Fall') ('08/30/2014', 'Fall') ('08/30/2013', 'Fall') ('08/30/2012', 'Fall')
voter_2
SELECT DISTINCT Registration_Date , Election_Cycle FROM VOTING_RECORD
What are the distinct registration dates and the election cycles?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('08/30/2015', 'Spring') ('08/30/2014', 'Spring') ('08/30/2013', 'Spring') ('08/30/2012', 'Spring') ('08/30/2015', 'Fall') ('08/30/2014', 'Fall') ('08/30/2013', 'Fall') ('08/30/2012', 'Fall')
voter_2
SELECT DISTINCT President_Vote , VICE_President_Vote FROM VOTING_RECORD
Report the distinct president vote and the vice president vote.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(1004, 1007) (1014, 1007) (1004, 1017) (1024, 1017)
voter_2
SELECT DISTINCT President_Vote , VICE_President_Vote FROM VOTING_RECORD
List all the distinct president votes and the vice president votes.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(1004, 1007) (1014, 1007) (1004, 1017) (1024, 1017)
voter_2
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_President_VOTE
Find the distinct last names of the students who have class president votes.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Smith',) ('Andreou',) ('Adams',)
voter_2
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_President_VOTE
What are the distinct last names of the students who have class president votes?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Smith',) ('Andreou',) ('Adams',)
voter_2
SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_Senator_VOTE
Find the distinct first names of the students who have class senator votes.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Eric',) ('Michael',)
voter_2
SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_Senator_VOTE
What are the distinct first names of the students who have class president votes?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Eric',) ('Michael',)
voter_2
SELECT DISTINCT T1.Age FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Secretary_Vote WHERE T2.Election_Cycle = "Fall"
Find the distinct ages of students who have secretary votes in the fall election cycle.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(17,) (22,)
voter_2
SELECT DISTINCT T1.Age FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Secretary_Vote WHERE T2.Election_Cycle = "Fall"
What are the distinct ages of students who have secretary votes in the fall election cycle?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(17,) (22,)
voter_2
SELECT DISTINCT T1.Advisor FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote WHERE T2.Election_Cycle = "Spring"
Find the distinct Advisor of students who have treasurer votes in the spring election cycle.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(5718,) (7134,)
voter_2
SELECT DISTINCT T1.Advisor FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote WHERE T2.Election_Cycle = "Spring"
Who served as an advisor for students who have treasurer votes in the spring election cycle?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(5718,) (7134,)
voter_2
SELECT DISTINCT T1.Major FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote
Find the distinct majors of students who have treasurer votes.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(50,) (520,)
voter_2
SELECT DISTINCT T1.Major FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote
What are the distinct majors that students with treasurer votes are studying?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(50,) (520,)
voter_2
SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.President_VOTE WHERE T1.sex = "F"
Find the first and last names of all the female (sex is F) students who have president votes.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Stacy', 'Prater')
voter_2
SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.President_VOTE WHERE T1.sex = "F"
What are the first and last names of all the female students who have president votes?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Stacy', 'Prater')
voter_2
SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_President_VOTE WHERE T1.age = 18
Find the first and last name of all the students of age 18 who have vice president votes.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Lisa', 'Apap')
voter_2
SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_President_VOTE WHERE T1.age = 18
What are the first names and last names of the students who are 18 years old and have vice president votes.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Lisa', 'Apap')
voter_2
SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.Sex = "M" AND T2.Election_Cycle = "Fall"
How many male (sex is M) students have class senator votes in the fall election cycle?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(5,)
voter_2
SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.Sex = "M" AND T2.Election_Cycle = "Fall"
Count the number of male students who had class senator votes in the fall election cycle.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(5,)
voter_2
SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.city_code = "NYC" AND T2.Election_Cycle = "Spring"
Find the number of students whose city code is NYC and who have class senator votes in the spring election cycle.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(0,)
voter_2
SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.city_code = "NYC" AND T2.Election_Cycle = "Spring"
Which students live in the city with code "NYC" and have class senator votes in the spring election cycle? Count the numbers.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(0,)
voter_2
SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.city_code = "NYC" AND T2.Election_Cycle = "Spring"
Find the average age of students who live in the city with code "NYC" and have secretary votes in the spring election cycle.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(22.0,)
voter_2
SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.city_code = "NYC" AND T2.Election_Cycle = "Spring"
What is the average age of students who have city code "NYC" and have secretary votes for the spring election cycle?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(22.0,)
voter_2
SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.Sex = "F" AND T2.Election_Cycle = "Spring"
Find the average age of female (sex is F) students who have secretary votes in the spring election cycle.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(21.0,)
voter_2
SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.Sex = "F" AND T2.Election_Cycle = "Spring"
What is the average age of the female students with secretary votes in the spring election cycle?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(21.0,)
voter_2
SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code = "PIT"
Find the distinct first names of all the students who have vice president votes and whose city code is not PIT.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Bruce',)
voter_2
SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code = "PIT"
What are the distinct first names of the students who have vice president votes and reside in a city whose city code is not PIT?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Bruce',)
voter_2
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote EXCEPT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = "2192"
Find the distinct last names of all the students who have president votes and whose advisor is not 2192.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Kumar',) ('Norris',) ('Prater',)
voter_2
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote EXCEPT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = "2192"
What are the distinct last names of the students who have president votes but do not have 2192 as the advisor?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Kumar',) ('Norris',) ('Prater',)
voter_2
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = "8741"
Find the distinct last names of all the students who have president votes and whose advisor is 8741.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Norris',)
voter_2
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = "8741"
What are the distinct last names of the students who have president votes and have 8741 as the advisor?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Norris',)
voter_2
SELECT Advisor , count(*) FROM STUDENT GROUP BY Advisor
For each advisor, report the total number of students advised by him or her.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(1121, 3) (1148, 3) (2192, 4) (2311, 3) (5718, 2) (7134, 2) (7271, 2) (7712, 1) (7723, 1) (7792, 1) (8423, 1) (8721, 1) (8722, 3) (8723, 1) (8741, 1) (8772, 3) (8918, 1) (9172, 1)
voter_2
SELECT Advisor , count(*) FROM STUDENT GROUP BY Advisor
How many students does each advisor have?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(1121, 3) (1148, 3) (2192, 4) (2311, 3) (5718, 2) (7134, 2) (7271, 2) (7712, 1) (7723, 1) (7792, 1) (8423, 1) (8721, 1) (8722, 3) (8723, 1) (8741, 1) (8772, 3) (8918, 1) (9172, 1)
voter_2
SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*) > 2
Report all advisors that advise more than 2 students.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(1121,) (1148,) (2192,) (2311,) (8722,) (8772,)
voter_2
SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*) > 2
Which advisors have more than two students?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(1121,) (1148,) (2192,) (2311,) (8722,) (8772,)
voter_2
SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*) < 3
Report all majors that have less than 3 students.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(50,) (100,) (540,)
voter_2
SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*) < 3
What are the majors only less than three students are studying?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(50,) (100,) (540,)
voter_2
SELECT Election_Cycle , count(*) FROM VOTING_RECORD GROUP BY Election_Cycle
For each election cycle, report the number of voting records.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Fall', 5) ('Spring', 5)
voter_2
SELECT Election_Cycle , count(*) FROM VOTING_RECORD GROUP BY Election_Cycle
Count the number of voting records for each election cycle.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('Fall', 5) ('Spring', 5)
voter_2
SELECT Major FROM STUDENT GROUP BY major ORDER BY count(*) DESC LIMIT 1
Which major has the most students?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(600,)
voter_2
SELECT Major FROM STUDENT GROUP BY major ORDER BY count(*) DESC LIMIT 1
Find the major that is studied by the largest number of students.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(600,)
voter_2
SELECT Major FROM STUDENT WHERE Sex = "F" GROUP BY major ORDER BY count(*) DESC LIMIT 1
What is the most common major among female (sex is F) students?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(600,)
voter_2
SELECT Major FROM STUDENT WHERE Sex = "F" GROUP BY major ORDER BY count(*) DESC LIMIT 1
Find the major that is studied by the most female students.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(600,)
voter_2
SELECT city_code FROM STUDENT GROUP BY city_code ORDER BY count(*) DESC LIMIT 1
What is the city_code of the city that the most students live in?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('PIT',)
voter_2
SELECT city_code FROM STUDENT GROUP BY city_code ORDER BY count(*) DESC LIMIT 1
Return the code of the city that has the most students.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
('PIT',)
voter_2
SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING count(*) > 2
Report the distinct advisors who have more than 2 students.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(1121,) (1148,) (2192,) (2311,) (8722,) (8772,)
voter_2
SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING count(*) > 2
Which advisors are advising more than 2 students?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Voting_record ( ...
(1121,) (1148,) (2192,) (2311,) (8722,) (8772,)
products_gen_characteristics
SELECT count(*) FROM products
How many products are there?
PRAGMA foreign_keys = ON; CREATE TABLE `Ref_Characteristic_Types` ( `characteristic_type_code` VARCHAR(15) PRIMARY KEY, `characteristic_type_description` VARCHAR(80) ); CREATE TABLE `Ref_Colors` ( `color_code` VARCHAR(15) PRIMARY KEY, `color_description` VARCHAR(80) ); CREATE TABLE `Ref_Product_Categories` ( `product_c...
(15,)
products_gen_characteristics
SELECT count(*) FROM products
Count the number of products.
PRAGMA foreign_keys = ON; CREATE TABLE `Ref_Characteristic_Types` ( `characteristic_type_code` VARCHAR(15) PRIMARY KEY, `characteristic_type_description` VARCHAR(80) ); CREATE TABLE `Ref_Colors` ( `color_code` VARCHAR(15) PRIMARY KEY, `color_description` VARCHAR(80) ); CREATE TABLE `Ref_Product_Categories` ( `product_c...
(15,)
products_gen_characteristics
SELECT count(*) FROM ref_colors
How many colors are there?
PRAGMA foreign_keys = ON; CREATE TABLE `Ref_Characteristic_Types` ( `characteristic_type_code` VARCHAR(15) PRIMARY KEY, `characteristic_type_description` VARCHAR(80) ); CREATE TABLE `Ref_Colors` ( `color_code` VARCHAR(15) PRIMARY KEY, `color_description` VARCHAR(80) ); CREATE TABLE `Ref_Product_Categories` ( `product_c...
(8,)
products_gen_characteristics
SELECT count(*) FROM ref_colors
Count the number of colors.
PRAGMA foreign_keys = ON; CREATE TABLE `Ref_Characteristic_Types` ( `characteristic_type_code` VARCHAR(15) PRIMARY KEY, `characteristic_type_description` VARCHAR(80) ); CREATE TABLE `Ref_Colors` ( `color_code` VARCHAR(15) PRIMARY KEY, `color_description` VARCHAR(80) ); CREATE TABLE `Ref_Product_Categories` ( `product_c...
(8,)
products_gen_characteristics
SELECT count(*) FROM CHARACTERISTICS
How many characteristics are there?
PRAGMA foreign_keys = ON; CREATE TABLE `Ref_Characteristic_Types` ( `characteristic_type_code` VARCHAR(15) PRIMARY KEY, `characteristic_type_description` VARCHAR(80) ); CREATE TABLE `Ref_Colors` ( `color_code` VARCHAR(15) PRIMARY KEY, `color_description` VARCHAR(80) ); CREATE TABLE `Ref_Product_Categories` ( `product_c...
(15,)
products_gen_characteristics
SELECT count(*) FROM CHARACTERISTICS
Count the number of characteristics.
PRAGMA foreign_keys = ON; CREATE TABLE `Ref_Characteristic_Types` ( `characteristic_type_code` VARCHAR(15) PRIMARY KEY, `characteristic_type_description` VARCHAR(80) ); CREATE TABLE `Ref_Colors` ( `color_code` VARCHAR(15) PRIMARY KEY, `color_description` VARCHAR(80) ); CREATE TABLE `Ref_Product_Categories` ( `product_c...
(15,)
products_gen_characteristics
SELECT product_name , typical_buying_price FROM products
What are the names and buying prices of all the products?
PRAGMA foreign_keys = ON; CREATE TABLE `Ref_Characteristic_Types` ( `characteristic_type_code` VARCHAR(15) PRIMARY KEY, `characteristic_type_description` VARCHAR(80) ); CREATE TABLE `Ref_Colors` ( `color_code` VARCHAR(15) PRIMARY KEY, `color_description` VARCHAR(80) ); CREATE TABLE `Ref_Product_Categories` ( `product_c...
('cumin', '') ('peper', '352447.2874677') ('basil', '503.8431967') ('borage', '') ('chili', '') ('ginger', '5.578') ('sesame', '1284268.0659') ('caraway', '24493') ('catnip', '12008702.623') ('flax', '339404395.7') ('chervil', '') ('voluptatem', '162') ('cinnam', '1686539.4') ('lotus', '43221310.465574') ('laurel', '')...