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
|
|---|---|---|---|---|---|---|
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What is the name of the department with the student that has the lowest GPA?
|
SELECT T2.dept_name FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code ORDER BY stu_gpa LIMIT 1
|
[
"SELECT",
"T2.dept_name",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"department",
"AS",
"T2",
"ON",
"T1.dept_code",
"=",
"T2.dept_code",
"ORDER",
"BY",
"stu_gpa",
"LIMIT",
"1"
] |
[
"select",
"t2",
".",
"dept_name",
"from",
"student",
"as",
"t1",
"join",
"department",
"as",
"t2",
"on",
"t1",
".",
"dept_code",
"=",
"t2",
".",
"dept_code",
"order",
"by",
"stu_gpa",
"limit",
"value"
] |
[
"What",
"is",
"the",
"name",
"of",
"the",
"department",
"with",
"the",
"student",
"that",
"has",
"the",
"lowest",
"GPA",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find the first name and gpa of the students whose gpa is lower than the average gpa of all students.
|
SELECT stu_fname , stu_gpa FROM student WHERE stu_gpa < (SELECT avg(stu_gpa) FROM student)
|
[
"SELECT",
"stu_fname",
",",
"stu_gpa",
"FROM",
"student",
"WHERE",
"stu_gpa",
"<",
"(",
"SELECT",
"avg",
"(",
"stu_gpa",
")",
"FROM",
"student",
")"
] |
[
"select",
"stu_fname",
",",
"stu_gpa",
"from",
"student",
"where",
"stu_gpa",
"<",
"(",
"select",
"avg",
"(",
"stu_gpa",
")",
"from",
"student",
")"
] |
[
"Find",
"the",
"first",
"name",
"and",
"gpa",
"of",
"the",
"students",
"whose",
"gpa",
"is",
"lower",
"than",
"the",
"average",
"gpa",
"of",
"all",
"students",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What is the first name and GPA of every student that has a GPA lower than average?
|
SELECT stu_fname , stu_gpa FROM student WHERE stu_gpa < (SELECT avg(stu_gpa) FROM student)
|
[
"SELECT",
"stu_fname",
",",
"stu_gpa",
"FROM",
"student",
"WHERE",
"stu_gpa",
"<",
"(",
"SELECT",
"avg",
"(",
"stu_gpa",
")",
"FROM",
"student",
")"
] |
[
"select",
"stu_fname",
",",
"stu_gpa",
"from",
"student",
"where",
"stu_gpa",
"<",
"(",
"select",
"avg",
"(",
"stu_gpa",
")",
"from",
"student",
")"
] |
[
"What",
"is",
"the",
"first",
"name",
"and",
"GPA",
"of",
"every",
"student",
"that",
"has",
"a",
"GPA",
"lower",
"than",
"average",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find the name and address of the department that has the highest number of students.
|
SELECT T2.dept_name , T2.dept_address FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 1
|
[
"SELECT",
"T2.dept_name",
",",
"T2.dept_address",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"department",
"AS",
"T2",
"ON",
"T1.dept_code",
"=",
"T2.dept_code",
"GROUP",
"BY",
"T1.dept_code",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"t2",
".",
"dept_name",
",",
"t2",
".",
"dept_address",
"from",
"student",
"as",
"t1",
"join",
"department",
"as",
"t2",
"on",
"t1",
".",
"dept_code",
"=",
"t2",
".",
"dept_code",
"group",
"by",
"t1",
".",
"dept_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"Find",
"the",
"name",
"and",
"address",
"of",
"the",
"department",
"that",
"has",
"the",
"highest",
"number",
"of",
"students",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What is the name and address of the department with the most students?
|
SELECT T2.dept_name , T2.dept_address FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 1
|
[
"SELECT",
"T2.dept_name",
",",
"T2.dept_address",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"department",
"AS",
"T2",
"ON",
"T1.dept_code",
"=",
"T2.dept_code",
"GROUP",
"BY",
"T1.dept_code",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"t2",
".",
"dept_name",
",",
"t2",
".",
"dept_address",
"from",
"student",
"as",
"t1",
"join",
"department",
"as",
"t2",
"on",
"t1",
".",
"dept_code",
"=",
"t2",
".",
"dept_code",
"group",
"by",
"t1",
".",
"dept_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"What",
"is",
"the",
"name",
"and",
"address",
"of",
"the",
"department",
"with",
"the",
"most",
"students",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find the name, address, number of students in the departments that have the top 3 highest number of students.
|
SELECT T2.dept_name , T2.dept_address , count(*) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 3
|
[
"SELECT",
"T2.dept_name",
",",
"T2.dept_address",
",",
"count",
"(",
"*",
")",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"department",
"AS",
"T2",
"ON",
"T1.dept_code",
"=",
"T2.dept_code",
"GROUP",
"BY",
"T1.dept_code",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"3"
] |
[
"select",
"t2",
".",
"dept_name",
",",
"t2",
".",
"dept_address",
",",
"count",
"(",
"*",
")",
"from",
"student",
"as",
"t1",
"join",
"department",
"as",
"t2",
"on",
"t1",
".",
"dept_code",
"=",
"t2",
".",
"dept_code",
"group",
"by",
"t1",
".",
"dept_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"Find",
"the",
"name",
",",
"address",
",",
"number",
"of",
"students",
"in",
"the",
"departments",
"that",
"have",
"the",
"top",
"3",
"highest",
"number",
"of",
"students",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What is the name, address, and number of students in the departments that have the 3 most students?
|
SELECT T2.dept_name , T2.dept_address , count(*) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 3
|
[
"SELECT",
"T2.dept_name",
",",
"T2.dept_address",
",",
"count",
"(",
"*",
")",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"department",
"AS",
"T2",
"ON",
"T1.dept_code",
"=",
"T2.dept_code",
"GROUP",
"BY",
"T1.dept_code",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"3"
] |
[
"select",
"t2",
".",
"dept_name",
",",
"t2",
".",
"dept_address",
",",
"count",
"(",
"*",
")",
"from",
"student",
"as",
"t1",
"join",
"department",
"as",
"t2",
"on",
"t1",
".",
"dept_code",
"=",
"t2",
".",
"dept_code",
"group",
"by",
"t1",
".",
"dept_code",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"What",
"is",
"the",
"name",
",",
"address",
",",
"and",
"number",
"of",
"students",
"in",
"the",
"departments",
"that",
"have",
"the",
"3",
"most",
"students",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find the first name and office of the professor who is in the history department and has a Ph.D. degree.
|
SELECT T1.emp_fname , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T3.dept_code = T2.dept_code WHERE T3.dept_name = 'History' AND T2.prof_high_degree = 'Ph.D.'
|
[
"SELECT",
"T1.emp_fname",
",",
"T2.prof_office",
"FROM",
"employee",
"AS",
"T1",
"JOIN",
"professor",
"AS",
"T2",
"ON",
"T1.emp_num",
"=",
"T2.emp_num",
"JOIN",
"department",
"AS",
"T3",
"ON",
"T3.dept_code",
"=",
"T2.dept_code",
"WHERE",
"T3.dept_name",
"=",
"'History",
"'",
"AND",
"T2.prof_high_degree",
"=",
"'Ph.D",
".",
"'"
] |
[
"select",
"t1",
".",
"emp_fname",
",",
"t2",
".",
"prof_office",
"from",
"employee",
"as",
"t1",
"join",
"professor",
"as",
"t2",
"on",
"t1",
".",
"emp_num",
"=",
"t2",
".",
"emp_num",
"join",
"department",
"as",
"t3",
"on",
"t3",
".",
"dept_code",
"=",
"t2",
".",
"dept_code",
"where",
"t3",
".",
"dept_name",
"=",
"value",
"and",
"t2",
".",
"prof_high_degree",
"=",
"value"
] |
[
"Find",
"the",
"first",
"name",
"and",
"office",
"of",
"the",
"professor",
"who",
"is",
"in",
"the",
"history",
"department",
"and",
"has",
"a",
"Ph.D.",
"degree",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What are the first names and office of the professors who are in the history department and have a Ph.D?
|
SELECT T1.emp_fname , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T3.dept_code = T2.dept_code WHERE T3.dept_name = 'History' AND T2.prof_high_degree = 'Ph.D.'
|
[
"SELECT",
"T1.emp_fname",
",",
"T2.prof_office",
"FROM",
"employee",
"AS",
"T1",
"JOIN",
"professor",
"AS",
"T2",
"ON",
"T1.emp_num",
"=",
"T2.emp_num",
"JOIN",
"department",
"AS",
"T3",
"ON",
"T3.dept_code",
"=",
"T2.dept_code",
"WHERE",
"T3.dept_name",
"=",
"'History",
"'",
"AND",
"T2.prof_high_degree",
"=",
"'Ph.D",
".",
"'"
] |
[
"select",
"t1",
".",
"emp_fname",
",",
"t2",
".",
"prof_office",
"from",
"employee",
"as",
"t1",
"join",
"professor",
"as",
"t2",
"on",
"t1",
".",
"emp_num",
"=",
"t2",
".",
"emp_num",
"join",
"department",
"as",
"t3",
"on",
"t3",
".",
"dept_code",
"=",
"t2",
".",
"dept_code",
"where",
"t3",
".",
"dept_name",
"=",
"value",
"and",
"t2",
".",
"prof_high_degree",
"=",
"value"
] |
[
"What",
"are",
"the",
"first",
"names",
"and",
"office",
"of",
"the",
"professors",
"who",
"are",
"in",
"the",
"history",
"department",
"and",
"have",
"a",
"Ph.D",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find the first names of all instructors who have taught some course and the course code.
|
SELECT T2.emp_fname , T1.crs_code FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num
|
[
"SELECT",
"T2.emp_fname",
",",
"T1.crs_code",
"FROM",
"CLASS",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.prof_num",
"=",
"T2.emp_num"
] |
[
"select",
"t2",
".",
"emp_fname",
",",
"t1",
".",
"crs_code",
"from",
"class",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"prof_num",
"=",
"t2",
".",
"emp_num"
] |
[
"Find",
"the",
"first",
"names",
"of",
"all",
"instructors",
"who",
"have",
"taught",
"some",
"course",
"and",
"the",
"course",
"code",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What are the first names of all teachers who have taught a course and the corresponding course codes?
|
SELECT T2.emp_fname , T1.crs_code FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num
|
[
"SELECT",
"T2.emp_fname",
",",
"T1.crs_code",
"FROM",
"CLASS",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.prof_num",
"=",
"T2.emp_num"
] |
[
"select",
"t2",
".",
"emp_fname",
",",
"t1",
".",
"crs_code",
"from",
"class",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"prof_num",
"=",
"t2",
".",
"emp_num"
] |
[
"What",
"are",
"the",
"first",
"names",
"of",
"all",
"teachers",
"who",
"have",
"taught",
"a",
"course",
"and",
"the",
"corresponding",
"course",
"codes",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find the first names of all instructors who have taught some course and the course description.
|
SELECT T2.emp_fname , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code
|
[
"SELECT",
"T2.emp_fname",
",",
"T3.crs_description",
"FROM",
"CLASS",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.prof_num",
"=",
"T2.emp_num",
"JOIN",
"course",
"AS",
"T3",
"ON",
"T1.crs_code",
"=",
"T3.crs_code"
] |
[
"select",
"t2",
".",
"emp_fname",
",",
"t3",
".",
"crs_description",
"from",
"class",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"prof_num",
"=",
"t2",
".",
"emp_num",
"join",
"course",
"as",
"t3",
"on",
"t1",
".",
"crs_code",
"=",
"t3",
".",
"crs_code"
] |
[
"Find",
"the",
"first",
"names",
"of",
"all",
"instructors",
"who",
"have",
"taught",
"some",
"course",
"and",
"the",
"course",
"description",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What are the first names of all teachers who have taught a course and the corresponding descriptions?
|
SELECT T2.emp_fname , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code
|
[
"SELECT",
"T2.emp_fname",
",",
"T3.crs_description",
"FROM",
"CLASS",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.prof_num",
"=",
"T2.emp_num",
"JOIN",
"course",
"AS",
"T3",
"ON",
"T1.crs_code",
"=",
"T3.crs_code"
] |
[
"select",
"t2",
".",
"emp_fname",
",",
"t3",
".",
"crs_description",
"from",
"class",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"prof_num",
"=",
"t2",
".",
"emp_num",
"join",
"course",
"as",
"t3",
"on",
"t1",
".",
"crs_code",
"=",
"t3",
".",
"crs_code"
] |
[
"What",
"are",
"the",
"first",
"names",
"of",
"all",
"teachers",
"who",
"have",
"taught",
"a",
"course",
"and",
"the",
"corresponding",
"descriptions",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find the first names and offices of all instructors who have taught some course and also find the course description.
|
SELECT T2.emp_fname , T4.prof_office , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num
|
[
"SELECT",
"T2.emp_fname",
",",
"T4.prof_office",
",",
"T3.crs_description",
"FROM",
"CLASS",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.prof_num",
"=",
"T2.emp_num",
"JOIN",
"course",
"AS",
"T3",
"ON",
"T1.crs_code",
"=",
"T3.crs_code",
"JOIN",
"professor",
"AS",
"T4",
"ON",
"T2.emp_num",
"=",
"T4.emp_num"
] |
[
"select",
"t2",
".",
"emp_fname",
",",
"t4",
".",
"prof_office",
",",
"t3",
".",
"crs_description",
"from",
"class",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"prof_num",
"=",
"t2",
".",
"emp_num",
"join",
"course",
"as",
"t3",
"on",
"t1",
".",
"crs_code",
"=",
"t3",
".",
"crs_code",
"join",
"professor",
"as",
"t4",
"on",
"t2",
".",
"emp_num",
"=",
"t4",
".",
"emp_num"
] |
[
"Find",
"the",
"first",
"names",
"and",
"offices",
"of",
"all",
"instructors",
"who",
"have",
"taught",
"some",
"course",
"and",
"also",
"find",
"the",
"course",
"description",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What are the first names, office locations of all lecturers who have taught some course?
|
SELECT T2.emp_fname , T4.prof_office , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num
|
[
"SELECT",
"T2.emp_fname",
",",
"T4.prof_office",
",",
"T3.crs_description",
"FROM",
"CLASS",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.prof_num",
"=",
"T2.emp_num",
"JOIN",
"course",
"AS",
"T3",
"ON",
"T1.crs_code",
"=",
"T3.crs_code",
"JOIN",
"professor",
"AS",
"T4",
"ON",
"T2.emp_num",
"=",
"T4.emp_num"
] |
[
"select",
"t2",
".",
"emp_fname",
",",
"t4",
".",
"prof_office",
",",
"t3",
".",
"crs_description",
"from",
"class",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"prof_num",
"=",
"t2",
".",
"emp_num",
"join",
"course",
"as",
"t3",
"on",
"t1",
".",
"crs_code",
"=",
"t3",
".",
"crs_code",
"join",
"professor",
"as",
"t4",
"on",
"t2",
".",
"emp_num",
"=",
"t4",
".",
"emp_num"
] |
[
"What",
"are",
"the",
"first",
"names",
",",
"office",
"locations",
"of",
"all",
"lecturers",
"who",
"have",
"taught",
"some",
"course",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find the first names and offices of all instructors who have taught some course and the course description and the department name.
|
SELECT T2.emp_fname , T4.prof_office , T3.crs_description , T5.dept_name FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num JOIN department AS T5 ON T4.dept_code = T5.dept_code
|
[
"SELECT",
"T2.emp_fname",
",",
"T4.prof_office",
",",
"T3.crs_description",
",",
"T5.dept_name",
"FROM",
"CLASS",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.prof_num",
"=",
"T2.emp_num",
"JOIN",
"course",
"AS",
"T3",
"ON",
"T1.crs_code",
"=",
"T3.crs_code",
"JOIN",
"professor",
"AS",
"T4",
"ON",
"T2.emp_num",
"=",
"T4.emp_num",
"JOIN",
"department",
"AS",
"T5",
"ON",
"T4.dept_code",
"=",
"T5.dept_code"
] |
[
"select",
"t2",
".",
"emp_fname",
",",
"t4",
".",
"prof_office",
",",
"t3",
".",
"crs_description",
",",
"t5",
".",
"dept_name",
"from",
"class",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"prof_num",
"=",
"t2",
".",
"emp_num",
"join",
"course",
"as",
"t3",
"on",
"t1",
".",
"crs_code",
"=",
"t3",
".",
"crs_code",
"join",
"professor",
"as",
"t4",
"on",
"t2",
".",
"emp_num",
"=",
"t4",
".",
"emp_num",
"join",
"department",
"as",
"t5",
"on",
"t4",
".",
"dept_code",
"=",
"t5",
".",
"dept_code"
] |
[
"Find",
"the",
"first",
"names",
"and",
"offices",
"of",
"all",
"instructors",
"who",
"have",
"taught",
"some",
"course",
"and",
"the",
"course",
"description",
"and",
"the",
"department",
"name",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What are the first names, office locations, and departments of all instructors, and also what are the descriptions of the courses they teach?
|
SELECT T2.emp_fname , T4.prof_office , T3.crs_description , T5.dept_name FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num JOIN department AS T5 ON T4.dept_code = T5.dept_code
|
[
"SELECT",
"T2.emp_fname",
",",
"T4.prof_office",
",",
"T3.crs_description",
",",
"T5.dept_name",
"FROM",
"CLASS",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.prof_num",
"=",
"T2.emp_num",
"JOIN",
"course",
"AS",
"T3",
"ON",
"T1.crs_code",
"=",
"T3.crs_code",
"JOIN",
"professor",
"AS",
"T4",
"ON",
"T2.emp_num",
"=",
"T4.emp_num",
"JOIN",
"department",
"AS",
"T5",
"ON",
"T4.dept_code",
"=",
"T5.dept_code"
] |
[
"select",
"t2",
".",
"emp_fname",
",",
"t4",
".",
"prof_office",
",",
"t3",
".",
"crs_description",
",",
"t5",
".",
"dept_name",
"from",
"class",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"prof_num",
"=",
"t2",
".",
"emp_num",
"join",
"course",
"as",
"t3",
"on",
"t1",
".",
"crs_code",
"=",
"t3",
".",
"crs_code",
"join",
"professor",
"as",
"t4",
"on",
"t2",
".",
"emp_num",
"=",
"t4",
".",
"emp_num",
"join",
"department",
"as",
"t5",
"on",
"t4",
".",
"dept_code",
"=",
"t5",
".",
"dept_code"
] |
[
"What",
"are",
"the",
"first",
"names",
",",
"office",
"locations",
",",
"and",
"departments",
"of",
"all",
"instructors",
",",
"and",
"also",
"what",
"are",
"the",
"descriptions",
"of",
"the",
"courses",
"they",
"teach",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find names of all students who took some course and the course description.
|
SELECT T1.stu_fname , T1.stu_lname , T4.crs_description FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code
|
[
"SELECT",
"T1.stu_fname",
",",
"T1.stu_lname",
",",
"T4.crs_description",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"enroll",
"AS",
"T2",
"ON",
"T1.stu_num",
"=",
"T2.stu_num",
"JOIN",
"CLASS",
"AS",
"T3",
"ON",
"T2.class_code",
"=",
"T3.class_code",
"JOIN",
"course",
"AS",
"T4",
"ON",
"T3.crs_code",
"=",
"T4.crs_code"
] |
[
"select",
"t1",
".",
"stu_fname",
",",
"t1",
".",
"stu_lname",
",",
"t4",
".",
"crs_description",
"from",
"student",
"as",
"t1",
"join",
"enroll",
"as",
"t2",
"on",
"t1",
".",
"stu_num",
"=",
"t2",
".",
"stu_num",
"join",
"class",
"as",
"t3",
"on",
"t2",
".",
"class_code",
"=",
"t3",
".",
"class_code",
"join",
"course",
"as",
"t4",
"on",
"t3",
".",
"crs_code",
"=",
"t4",
".",
"crs_code"
] |
[
"Find",
"names",
"of",
"all",
"students",
"who",
"took",
"some",
"course",
"and",
"the",
"course",
"description",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What are the names of all students who took a class and the corresponding course descriptions?
|
SELECT T1.stu_fname , T1.stu_lname , T4.crs_description FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code
|
[
"SELECT",
"T1.stu_fname",
",",
"T1.stu_lname",
",",
"T4.crs_description",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"enroll",
"AS",
"T2",
"ON",
"T1.stu_num",
"=",
"T2.stu_num",
"JOIN",
"CLASS",
"AS",
"T3",
"ON",
"T2.class_code",
"=",
"T3.class_code",
"JOIN",
"course",
"AS",
"T4",
"ON",
"T3.crs_code",
"=",
"T4.crs_code"
] |
[
"select",
"t1",
".",
"stu_fname",
",",
"t1",
".",
"stu_lname",
",",
"t4",
".",
"crs_description",
"from",
"student",
"as",
"t1",
"join",
"enroll",
"as",
"t2",
"on",
"t1",
".",
"stu_num",
"=",
"t2",
".",
"stu_num",
"join",
"class",
"as",
"t3",
"on",
"t2",
".",
"class_code",
"=",
"t3",
".",
"class_code",
"join",
"course",
"as",
"t4",
"on",
"t3",
".",
"crs_code",
"=",
"t4",
".",
"crs_code"
] |
[
"What",
"are",
"the",
"names",
"of",
"all",
"students",
"who",
"took",
"a",
"class",
"and",
"the",
"corresponding",
"course",
"descriptions",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find names of all students who took some course and got A or C.
|
SELECT T1.stu_fname , T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'C' OR T2.enroll_grade = 'A'
|
[
"SELECT",
"T1.stu_fname",
",",
"T1.stu_lname",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"enroll",
"AS",
"T2",
"ON",
"T1.stu_num",
"=",
"T2.stu_num",
"WHERE",
"T2.enroll_grade",
"=",
"'C",
"'",
"OR",
"T2.enroll_grade",
"=",
"'A",
"'"
] |
[
"select",
"t1",
".",
"stu_fname",
",",
"t1",
".",
"stu_lname",
"from",
"student",
"as",
"t1",
"join",
"enroll",
"as",
"t2",
"on",
"t1",
".",
"stu_num",
"=",
"t2",
".",
"stu_num",
"where",
"t2",
".",
"enroll_grade",
"=",
"value",
"or",
"t2",
".",
"enroll_grade",
"=",
"value"
] |
[
"Find",
"names",
"of",
"all",
"students",
"who",
"took",
"some",
"course",
"and",
"got",
"A",
"or",
"C",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What are the names of all students taking a course who received an A or C?
|
SELECT T1.stu_fname , T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'C' OR T2.enroll_grade = 'A'
|
[
"SELECT",
"T1.stu_fname",
",",
"T1.stu_lname",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"enroll",
"AS",
"T2",
"ON",
"T1.stu_num",
"=",
"T2.stu_num",
"WHERE",
"T2.enroll_grade",
"=",
"'C",
"'",
"OR",
"T2.enroll_grade",
"=",
"'A",
"'"
] |
[
"select",
"t1",
".",
"stu_fname",
",",
"t1",
".",
"stu_lname",
"from",
"student",
"as",
"t1",
"join",
"enroll",
"as",
"t2",
"on",
"t1",
".",
"stu_num",
"=",
"t2",
".",
"stu_num",
"where",
"t2",
".",
"enroll_grade",
"=",
"value",
"or",
"t2",
".",
"enroll_grade",
"=",
"value"
] |
[
"What",
"are",
"the",
"names",
"of",
"all",
"students",
"taking",
"a",
"course",
"who",
"received",
"an",
"A",
"or",
"C",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find the first names of all professors in the Accounting department who is teaching some course and the class room.
|
SELECT T2.emp_fname , T1.class_room FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Accounting'
|
[
"SELECT",
"T2.emp_fname",
",",
"T1.class_room",
"FROM",
"CLASS",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.prof_num",
"=",
"T2.emp_num",
"JOIN",
"professor",
"AS",
"T3",
"ON",
"T2.emp_num",
"=",
"T3.emp_num",
"JOIN",
"department",
"AS",
"T4",
"ON",
"T4.dept_code",
"=",
"T3.dept_code",
"WHERE",
"T4.dept_name",
"=",
"'Accounting",
"'"
] |
[
"select",
"t2",
".",
"emp_fname",
",",
"t1",
".",
"class_room",
"from",
"class",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"prof_num",
"=",
"t2",
".",
"emp_num",
"join",
"professor",
"as",
"t3",
"on",
"t2",
".",
"emp_num",
"=",
"t3",
".",
"emp_num",
"join",
"department",
"as",
"t4",
"on",
"t4",
".",
"dept_code",
"=",
"t3",
".",
"dept_code",
"where",
"t4",
".",
"dept_name",
"=",
"value"
] |
[
"Find",
"the",
"first",
"names",
"of",
"all",
"professors",
"in",
"the",
"Accounting",
"department",
"who",
"is",
"teaching",
"some",
"course",
"and",
"the",
"class",
"room",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What are the first names of all Accounting professors who teach and what are the classrooms of the courses they teach?
|
SELECT T2.emp_fname , T1.class_room FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Accounting'
|
[
"SELECT",
"T2.emp_fname",
",",
"T1.class_room",
"FROM",
"CLASS",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.prof_num",
"=",
"T2.emp_num",
"JOIN",
"professor",
"AS",
"T3",
"ON",
"T2.emp_num",
"=",
"T3.emp_num",
"JOIN",
"department",
"AS",
"T4",
"ON",
"T4.dept_code",
"=",
"T3.dept_code",
"WHERE",
"T4.dept_name",
"=",
"'Accounting",
"'"
] |
[
"select",
"t2",
".",
"emp_fname",
",",
"t1",
".",
"class_room",
"from",
"class",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"prof_num",
"=",
"t2",
".",
"emp_num",
"join",
"professor",
"as",
"t3",
"on",
"t2",
".",
"emp_num",
"=",
"t3",
".",
"emp_num",
"join",
"department",
"as",
"t4",
"on",
"t4",
".",
"dept_code",
"=",
"t3",
".",
"dept_code",
"where",
"t4",
".",
"dept_name",
"=",
"value"
] |
[
"What",
"are",
"the",
"first",
"names",
"of",
"all",
"Accounting",
"professors",
"who",
"teach",
"and",
"what",
"are",
"the",
"classrooms",
"of",
"the",
"courses",
"they",
"teach",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find the first names and degree of all professors who are teaching some class in Computer Info. Systems department.
|
SELECT DISTINCT T2.emp_fname , T3.prof_high_degree FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Computer Info. Systems'
|
[
"SELECT",
"DISTINCT",
"T2.emp_fname",
",",
"T3.prof_high_degree",
"FROM",
"CLASS",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.prof_num",
"=",
"T2.emp_num",
"JOIN",
"professor",
"AS",
"T3",
"ON",
"T2.emp_num",
"=",
"T3.emp_num",
"JOIN",
"department",
"AS",
"T4",
"ON",
"T4.dept_code",
"=",
"T3.dept_code",
"WHERE",
"T4.dept_name",
"=",
"'Computer",
"Info",
".",
"Systems",
"'"
] |
[
"select",
"distinct",
"t2",
".",
"emp_fname",
",",
"t3",
".",
"prof_high_degree",
"from",
"class",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"prof_num",
"=",
"t2",
".",
"emp_num",
"join",
"professor",
"as",
"t3",
"on",
"t2",
".",
"emp_num",
"=",
"t3",
".",
"emp_num",
"join",
"department",
"as",
"t4",
"on",
"t4",
".",
"dept_code",
"=",
"t3",
".",
"dept_code",
"where",
"t4",
".",
"dept_name",
"=",
"value"
] |
[
"Find",
"the",
"first",
"names",
"and",
"degree",
"of",
"all",
"professors",
"who",
"are",
"teaching",
"some",
"class",
"in",
"Computer",
"Info",
".",
"Systems",
"department",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What are the different first names and highest degree attained for professors teaching in the Computer Information Systems department?
|
SELECT DISTINCT T2.emp_fname , T3.prof_high_degree FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Computer Info. Systems'
|
[
"SELECT",
"DISTINCT",
"T2.emp_fname",
",",
"T3.prof_high_degree",
"FROM",
"CLASS",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.prof_num",
"=",
"T2.emp_num",
"JOIN",
"professor",
"AS",
"T3",
"ON",
"T2.emp_num",
"=",
"T3.emp_num",
"JOIN",
"department",
"AS",
"T4",
"ON",
"T4.dept_code",
"=",
"T3.dept_code",
"WHERE",
"T4.dept_name",
"=",
"'Computer",
"Info",
".",
"Systems",
"'"
] |
[
"select",
"distinct",
"t2",
".",
"emp_fname",
",",
"t3",
".",
"prof_high_degree",
"from",
"class",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"prof_num",
"=",
"t2",
".",
"emp_num",
"join",
"professor",
"as",
"t3",
"on",
"t2",
".",
"emp_num",
"=",
"t3",
".",
"emp_num",
"join",
"department",
"as",
"t4",
"on",
"t4",
".",
"dept_code",
"=",
"t3",
".",
"dept_code",
"where",
"t4",
".",
"dept_name",
"=",
"value"
] |
[
"What",
"are",
"the",
"different",
"first",
"names",
"and",
"highest",
"degree",
"attained",
"for",
"professors",
"teaching",
"in",
"the",
"Computer",
"Information",
"Systems",
"department",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What is the last name of the student who got a grade A in the class with code 10018.
|
SELECT T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'A' AND T2.class_code = 10018
|
[
"SELECT",
"T1.stu_lname",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"enroll",
"AS",
"T2",
"ON",
"T1.stu_num",
"=",
"T2.stu_num",
"WHERE",
"T2.enroll_grade",
"=",
"'A",
"'",
"AND",
"T2.class_code",
"=",
"10018"
] |
[
"select",
"t1",
".",
"stu_lname",
"from",
"student",
"as",
"t1",
"join",
"enroll",
"as",
"t2",
"on",
"t1",
".",
"stu_num",
"=",
"t2",
".",
"stu_num",
"where",
"t2",
".",
"enroll_grade",
"=",
"value",
"and",
"t2",
".",
"class_code",
"=",
"value"
] |
[
"What",
"is",
"the",
"last",
"name",
"of",
"the",
"student",
"who",
"got",
"a",
"grade",
"A",
"in",
"the",
"class",
"with",
"code",
"10018",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What is the last name of the student who received an A in the class with the code 10018?
|
SELECT T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'A' AND T2.class_code = 10018
|
[
"SELECT",
"T1.stu_lname",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"enroll",
"AS",
"T2",
"ON",
"T1.stu_num",
"=",
"T2.stu_num",
"WHERE",
"T2.enroll_grade",
"=",
"'A",
"'",
"AND",
"T2.class_code",
"=",
"10018"
] |
[
"select",
"t1",
".",
"stu_lname",
"from",
"student",
"as",
"t1",
"join",
"enroll",
"as",
"t2",
"on",
"t1",
".",
"stu_num",
"=",
"t2",
".",
"stu_num",
"where",
"t2",
".",
"enroll_grade",
"=",
"value",
"and",
"t2",
".",
"class_code",
"=",
"value"
] |
[
"What",
"is",
"the",
"last",
"name",
"of",
"the",
"student",
"who",
"received",
"an",
"A",
"in",
"the",
"class",
"with",
"the",
"code",
"10018",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find the first name and office of history professor who did not get a Ph.D. degree.
|
SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T1.dept_code = T3.dept_code WHERE T3.dept_name = 'History' AND T1.prof_high_degree != 'Ph.D.'
|
[
"SELECT",
"T2.emp_fname",
",",
"T1.prof_office",
"FROM",
"professor",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.emp_num",
"=",
"T2.emp_num",
"JOIN",
"department",
"AS",
"T3",
"ON",
"T1.dept_code",
"=",
"T3.dept_code",
"WHERE",
"T3.dept_name",
"=",
"'History",
"'",
"AND",
"T1.prof_high_degree",
"!",
"=",
"'Ph.D",
".",
"'"
] |
[
"select",
"t2",
".",
"emp_fname",
",",
"t1",
".",
"prof_office",
"from",
"professor",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"emp_num",
"=",
"t2",
".",
"emp_num",
"join",
"department",
"as",
"t3",
"on",
"t1",
".",
"dept_code",
"=",
"t3",
".",
"dept_code",
"where",
"t3",
".",
"dept_name",
"=",
"value",
"and",
"t1",
".",
"prof_high_degree",
"!",
"=",
"value"
] |
[
"Find",
"the",
"first",
"name",
"and",
"office",
"of",
"history",
"professor",
"who",
"did",
"not",
"get",
"a",
"Ph.D.",
"degree",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What are the first names and offices of history professors who don't have Ph.D.s?
|
SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T1.dept_code = T3.dept_code WHERE T3.dept_name = 'History' AND T1.prof_high_degree != 'Ph.D.'
|
[
"SELECT",
"T2.emp_fname",
",",
"T1.prof_office",
"FROM",
"professor",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.emp_num",
"=",
"T2.emp_num",
"JOIN",
"department",
"AS",
"T3",
"ON",
"T1.dept_code",
"=",
"T3.dept_code",
"WHERE",
"T3.dept_name",
"=",
"'History",
"'",
"AND",
"T1.prof_high_degree",
"!",
"=",
"'Ph.D",
".",
"'"
] |
[
"select",
"t2",
".",
"emp_fname",
",",
"t1",
".",
"prof_office",
"from",
"professor",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"emp_num",
"=",
"t2",
".",
"emp_num",
"join",
"department",
"as",
"t3",
"on",
"t1",
".",
"dept_code",
"=",
"t3",
".",
"dept_code",
"where",
"t3",
".",
"dept_name",
"=",
"value",
"and",
"t1",
".",
"prof_high_degree",
"!",
"=",
"value"
] |
[
"What",
"are",
"the",
"first",
"names",
"and",
"offices",
"of",
"history",
"professors",
"who",
"do",
"n't",
"have",
"Ph.D.s",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find the first names of professors who are teaching more than one class.
|
SELECT T2.emp_fname FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING count(*) > 1
|
[
"SELECT",
"T2.emp_fname",
"FROM",
"CLASS",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.prof_num",
"=",
"T2.emp_num",
"GROUP",
"BY",
"T1.prof_num",
"HAVING",
"count",
"(",
"*",
")",
">",
"1"
] |
[
"select",
"t2",
".",
"emp_fname",
"from",
"class",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"prof_num",
"=",
"t2",
".",
"emp_num",
"group",
"by",
"t1",
".",
"prof_num",
"having",
"count",
"(",
"*",
")",
">",
"value"
] |
[
"Find",
"the",
"first",
"names",
"of",
"professors",
"who",
"are",
"teaching",
"more",
"than",
"one",
"class",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What are the first names of all professors who teach more than one class?
|
SELECT T2.emp_fname FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING count(*) > 1
|
[
"SELECT",
"T2.emp_fname",
"FROM",
"CLASS",
"AS",
"T1",
"JOIN",
"employee",
"AS",
"T2",
"ON",
"T1.prof_num",
"=",
"T2.emp_num",
"GROUP",
"BY",
"T1.prof_num",
"HAVING",
"count",
"(",
"*",
")",
">",
"1"
] |
[
"select",
"t2",
".",
"emp_fname",
"from",
"class",
"as",
"t1",
"join",
"employee",
"as",
"t2",
"on",
"t1",
".",
"prof_num",
"=",
"t2",
".",
"emp_num",
"group",
"by",
"t1",
".",
"prof_num",
"having",
"count",
"(",
"*",
")",
">",
"value"
] |
[
"What",
"are",
"the",
"first",
"names",
"of",
"all",
"professors",
"who",
"teach",
"more",
"than",
"one",
"class",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find the first names of students who took exactly one class.
|
SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num GROUP BY T2.stu_num HAVING count(*) = 1
|
[
"SELECT",
"T1.stu_fname",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"enroll",
"AS",
"T2",
"ON",
"T1.stu_num",
"=",
"T2.stu_num",
"GROUP",
"BY",
"T2.stu_num",
"HAVING",
"count",
"(",
"*",
")",
"=",
"1"
] |
[
"select",
"t1",
".",
"stu_fname",
"from",
"student",
"as",
"t1",
"join",
"enroll",
"as",
"t2",
"on",
"t1",
".",
"stu_num",
"=",
"t2",
".",
"stu_num",
"group",
"by",
"t2",
".",
"stu_num",
"having",
"count",
"(",
"*",
")",
"=",
"value"
] |
[
"Find",
"the",
"first",
"names",
"of",
"students",
"who",
"took",
"exactly",
"one",
"class",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What are the first names of student who only took one course?
|
SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num GROUP BY T2.stu_num HAVING count(*) = 1
|
[
"SELECT",
"T1.stu_fname",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"enroll",
"AS",
"T2",
"ON",
"T1.stu_num",
"=",
"T2.stu_num",
"GROUP",
"BY",
"T2.stu_num",
"HAVING",
"count",
"(",
"*",
")",
"=",
"1"
] |
[
"select",
"t1",
".",
"stu_fname",
"from",
"student",
"as",
"t1",
"join",
"enroll",
"as",
"t2",
"on",
"t1",
".",
"stu_num",
"=",
"t2",
".",
"stu_num",
"group",
"by",
"t2",
".",
"stu_num",
"having",
"count",
"(",
"*",
")",
"=",
"value"
] |
[
"What",
"are",
"the",
"first",
"names",
"of",
"student",
"who",
"only",
"took",
"one",
"course",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
Find the name of department that offers the class whose description has the word "Statistics".
|
SELECT T2.dept_name FROM course AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.crs_description LIKE '%Statistics%'
|
[
"SELECT",
"T2.dept_name",
"FROM",
"course",
"AS",
"T1",
"JOIN",
"department",
"AS",
"T2",
"ON",
"T1.dept_code",
"=",
"T2.dept_code",
"WHERE",
"T1.crs_description",
"LIKE",
"'",
"%",
"Statistics",
"%",
"'"
] |
[
"select",
"t2",
".",
"dept_name",
"from",
"course",
"as",
"t1",
"join",
"department",
"as",
"t2",
"on",
"t1",
".",
"dept_code",
"=",
"t2",
".",
"dept_code",
"where",
"t1",
".",
"crs_description",
"like",
"value"
] |
[
"Find",
"the",
"name",
"of",
"department",
"that",
"offers",
"the",
"class",
"whose",
"description",
"has",
"the",
"word",
"``",
"Statistics",
"''",
"."
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What is the name of the department that offers a course that has a description including the word "Statistics"?
|
SELECT T2.dept_name FROM course AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.crs_description LIKE '%Statistics%'
|
[
"SELECT",
"T2.dept_name",
"FROM",
"course",
"AS",
"T1",
"JOIN",
"department",
"AS",
"T2",
"ON",
"T1.dept_code",
"=",
"T2.dept_code",
"WHERE",
"T1.crs_description",
"LIKE",
"'",
"%",
"Statistics",
"%",
"'"
] |
[
"select",
"t2",
".",
"dept_name",
"from",
"course",
"as",
"t1",
"join",
"department",
"as",
"t2",
"on",
"t1",
".",
"dept_code",
"=",
"t2",
".",
"dept_code",
"where",
"t1",
".",
"crs_description",
"like",
"value"
] |
[
"What",
"is",
"the",
"name",
"of",
"the",
"department",
"that",
"offers",
"a",
"course",
"that",
"has",
"a",
"description",
"including",
"the",
"word",
"``",
"Statistics",
"''",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What is the first name of the student whose last name starting with the letter S and is taking ACCT-211 class?
|
SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211' AND T1.stu_lname LIKE 'S%'
|
[
"SELECT",
"T1.stu_fname",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"enroll",
"AS",
"T2",
"ON",
"T1.stu_num",
"=",
"T2.stu_num",
"JOIN",
"CLASS",
"AS",
"T3",
"ON",
"T2.class_code",
"=",
"T3.class_code",
"WHERE",
"T3.crs_code",
"=",
"'ACCT-211",
"'",
"AND",
"T1.stu_lname",
"LIKE",
"'S",
"%",
"'"
] |
[
"select",
"t1",
".",
"stu_fname",
"from",
"student",
"as",
"t1",
"join",
"enroll",
"as",
"t2",
"on",
"t1",
".",
"stu_num",
"=",
"t2",
".",
"stu_num",
"join",
"class",
"as",
"t3",
"on",
"t2",
".",
"class_code",
"=",
"t3",
".",
"class_code",
"where",
"t3",
".",
"crs_code",
"=",
"value",
"and",
"t1",
".",
"stu_lname",
"like",
"value"
] |
[
"What",
"is",
"the",
"first",
"name",
"of",
"the",
"student",
"whose",
"last",
"name",
"starting",
"with",
"the",
"letter",
"S",
"and",
"is",
"taking",
"ACCT-211",
"class",
"?"
] |
college_1
|
[
"CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);",
"CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);",
"CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);",
"CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);",
"CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"
] |
What is the first name of the student whose last name starts with the letter S and is taking ACCT-211?
|
SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211' AND T1.stu_lname LIKE 'S%'
|
[
"SELECT",
"T1.stu_fname",
"FROM",
"student",
"AS",
"T1",
"JOIN",
"enroll",
"AS",
"T2",
"ON",
"T1.stu_num",
"=",
"T2.stu_num",
"JOIN",
"CLASS",
"AS",
"T3",
"ON",
"T2.class_code",
"=",
"T3.class_code",
"WHERE",
"T3.crs_code",
"=",
"'ACCT-211",
"'",
"AND",
"T1.stu_lname",
"LIKE",
"'S",
"%",
"'"
] |
[
"select",
"t1",
".",
"stu_fname",
"from",
"student",
"as",
"t1",
"join",
"enroll",
"as",
"t2",
"on",
"t1",
".",
"stu_num",
"=",
"t2",
".",
"stu_num",
"join",
"class",
"as",
"t3",
"on",
"t2",
".",
"class_code",
"=",
"t3",
".",
"class_code",
"where",
"t3",
".",
"crs_code",
"=",
"value",
"and",
"t1",
".",
"stu_lname",
"like",
"value"
] |
[
"What",
"is",
"the",
"first",
"name",
"of",
"the",
"student",
"whose",
"last",
"name",
"starts",
"with",
"the",
"letter",
"S",
"and",
"is",
"taking",
"ACCT-211",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
How many clubs are there?
|
SELECT count(*) FROM club
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"club"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"club"
] |
[
"How",
"many",
"clubs",
"are",
"there",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What is the total number of clubs?
|
SELECT count(*) FROM club
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"club"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"club"
] |
[
"What",
"is",
"the",
"total",
"number",
"of",
"clubs",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
List the distinct region of clubs in ascending alphabetical order.
|
SELECT DISTINCT Region FROM club ORDER BY Region ASC
|
[
"SELECT",
"DISTINCT",
"Region",
"FROM",
"club",
"ORDER",
"BY",
"Region",
"ASC"
] |
[
"select",
"distinct",
"region",
"from",
"club",
"order",
"by",
"region",
"asc"
] |
[
"List",
"the",
"distinct",
"region",
"of",
"clubs",
"in",
"ascending",
"alphabetical",
"order",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the different regions of clubs in ascending alphabetical order?
|
SELECT DISTINCT Region FROM club ORDER BY Region ASC
|
[
"SELECT",
"DISTINCT",
"Region",
"FROM",
"club",
"ORDER",
"BY",
"Region",
"ASC"
] |
[
"select",
"distinct",
"region",
"from",
"club",
"order",
"by",
"region",
"asc"
] |
[
"What",
"are",
"the",
"different",
"regions",
"of",
"clubs",
"in",
"ascending",
"alphabetical",
"order",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What is the average number of gold medals for clubs?
|
SELECT avg(Gold) FROM club_rank
|
[
"SELECT",
"avg",
"(",
"Gold",
")",
"FROM",
"club_rank"
] |
[
"select",
"avg",
"(",
"gold",
")",
"from",
"club_rank"
] |
[
"What",
"is",
"the",
"average",
"number",
"of",
"gold",
"medals",
"for",
"clubs",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What is the average number of gold medals for a club?
|
SELECT avg(Gold) FROM club_rank
|
[
"SELECT",
"avg",
"(",
"Gold",
")",
"FROM",
"club_rank"
] |
[
"select",
"avg",
"(",
"gold",
")",
"from",
"club_rank"
] |
[
"What",
"is",
"the",
"average",
"number",
"of",
"gold",
"medals",
"for",
"a",
"club",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the types and countries of competitions?
|
SELECT Competition_type , Country FROM competition
|
[
"SELECT",
"Competition_type",
",",
"Country",
"FROM",
"competition"
] |
[
"select",
"competition_type",
",",
"country",
"from",
"competition"
] |
[
"What",
"are",
"the",
"types",
"and",
"countries",
"of",
"competitions",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the types of every competition and in which countries are they located?
|
SELECT Competition_type , Country FROM competition
|
[
"SELECT",
"Competition_type",
",",
"Country",
"FROM",
"competition"
] |
[
"select",
"competition_type",
",",
"country",
"from",
"competition"
] |
[
"What",
"are",
"the",
"types",
"of",
"every",
"competition",
"and",
"in",
"which",
"countries",
"are",
"they",
"located",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the distinct years in which the competitions type is not "Tournament"?
|
SELECT DISTINCT YEAR FROM competition WHERE Competition_type != "Tournament"
|
[
"SELECT",
"DISTINCT",
"YEAR",
"FROM",
"competition",
"WHERE",
"Competition_type",
"!",
"=",
"``",
"Tournament",
"''"
] |
[
"select",
"distinct",
"year",
"from",
"competition",
"where",
"competition_type",
"!",
"=",
"value"
] |
[
"What",
"are",
"the",
"distinct",
"years",
"in",
"which",
"the",
"competitions",
"type",
"is",
"not",
"``",
"Tournament",
"''",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the different years for all competitions that are not of type equal to tournament?
|
SELECT DISTINCT YEAR FROM competition WHERE Competition_type != "Tournament"
|
[
"SELECT",
"DISTINCT",
"YEAR",
"FROM",
"competition",
"WHERE",
"Competition_type",
"!",
"=",
"``",
"Tournament",
"''"
] |
[
"select",
"distinct",
"year",
"from",
"competition",
"where",
"competition_type",
"!",
"=",
"value"
] |
[
"What",
"are",
"the",
"different",
"years",
"for",
"all",
"competitions",
"that",
"are",
"not",
"of",
"type",
"equal",
"to",
"tournament",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the maximum and minimum number of silver medals for clubs.
|
SELECT max(Silver) , min(Silver) FROM club_rank
|
[
"SELECT",
"max",
"(",
"Silver",
")",
",",
"min",
"(",
"Silver",
")",
"FROM",
"club_rank"
] |
[
"select",
"max",
"(",
"silver",
")",
",",
"min",
"(",
"silver",
")",
"from",
"club_rank"
] |
[
"What",
"are",
"the",
"maximum",
"and",
"minimum",
"number",
"of",
"silver",
"medals",
"for",
"clubs",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the maximum and minimum number of silver medals for all the clubs?
|
SELECT max(Silver) , min(Silver) FROM club_rank
|
[
"SELECT",
"max",
"(",
"Silver",
")",
",",
"min",
"(",
"Silver",
")",
"FROM",
"club_rank"
] |
[
"select",
"max",
"(",
"silver",
")",
",",
"min",
"(",
"silver",
")",
"from",
"club_rank"
] |
[
"What",
"are",
"the",
"maximum",
"and",
"minimum",
"number",
"of",
"silver",
"medals",
"for",
"all",
"the",
"clubs",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
How many clubs have total medals less than 10?
|
SELECT count(*) FROM club_rank WHERE Total < 10
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"club_rank",
"WHERE",
"Total",
"<",
"10"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"club_rank",
"where",
"total",
"<",
"value"
] |
[
"How",
"many",
"clubs",
"have",
"total",
"medals",
"less",
"than",
"10",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What is the total number of clubs that have less than 10 medals in total?
|
SELECT count(*) FROM club_rank WHERE Total < 10
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"club_rank",
"WHERE",
"Total",
"<",
"10"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"club_rank",
"where",
"total",
"<",
"value"
] |
[
"What",
"is",
"the",
"total",
"number",
"of",
"clubs",
"that",
"have",
"less",
"than",
"10",
"medals",
"in",
"total",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
List all club names in ascending order of start year.
|
SELECT name FROM club ORDER BY Start_year ASC
|
[
"SELECT",
"name",
"FROM",
"club",
"ORDER",
"BY",
"Start_year",
"ASC"
] |
[
"select",
"name",
"from",
"club",
"order",
"by",
"start_year",
"asc"
] |
[
"List",
"all",
"club",
"names",
"in",
"ascending",
"order",
"of",
"start",
"year",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the names of all the clubs starting with the oldest?
|
SELECT name FROM club ORDER BY Start_year ASC
|
[
"SELECT",
"name",
"FROM",
"club",
"ORDER",
"BY",
"Start_year",
"ASC"
] |
[
"select",
"name",
"from",
"club",
"order",
"by",
"start_year",
"asc"
] |
[
"What",
"are",
"the",
"names",
"of",
"all",
"the",
"clubs",
"starting",
"with",
"the",
"oldest",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
List all club names in descending alphabetical order.
|
SELECT name FROM club ORDER BY name DESC
|
[
"SELECT",
"name",
"FROM",
"club",
"ORDER",
"BY",
"name",
"DESC"
] |
[
"select",
"name",
"from",
"club",
"order",
"by",
"name",
"desc"
] |
[
"List",
"all",
"club",
"names",
"in",
"descending",
"alphabetical",
"order",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the names of all the clubs ordered in descending alphabetical order?
|
SELECT name FROM club ORDER BY name DESC
|
[
"SELECT",
"name",
"FROM",
"club",
"ORDER",
"BY",
"name",
"DESC"
] |
[
"select",
"name",
"from",
"club",
"order",
"by",
"name",
"desc"
] |
[
"What",
"are",
"the",
"names",
"of",
"all",
"the",
"clubs",
"ordered",
"in",
"descending",
"alphabetical",
"order",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
Please show the names and the players of clubs.
|
SELECT T1.name , T2.Player_id FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID
|
[
"SELECT",
"T1.name",
",",
"T2.Player_id",
"FROM",
"club",
"AS",
"T1",
"JOIN",
"player",
"AS",
"T2",
"ON",
"T1.Club_ID",
"=",
"T2.Club_ID"
] |
[
"select",
"t1",
".",
"name",
",",
"t2",
".",
"player_id",
"from",
"club",
"as",
"t1",
"join",
"player",
"as",
"t2",
"on",
"t1",
".",
"club_id",
"=",
"t2",
".",
"club_id"
] |
[
"Please",
"show",
"the",
"names",
"and",
"the",
"players",
"of",
"clubs",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the names and players of all the clubs?
|
SELECT T1.name , T2.Player_id FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID
|
[
"SELECT",
"T1.name",
",",
"T2.Player_id",
"FROM",
"club",
"AS",
"T1",
"JOIN",
"player",
"AS",
"T2",
"ON",
"T1.Club_ID",
"=",
"T2.Club_ID"
] |
[
"select",
"t1",
".",
"name",
",",
"t2",
".",
"player_id",
"from",
"club",
"as",
"t1",
"join",
"player",
"as",
"t2",
"on",
"t1",
".",
"club_id",
"=",
"t2",
".",
"club_id"
] |
[
"What",
"are",
"the",
"names",
"and",
"players",
"of",
"all",
"the",
"clubs",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
Show the names of clubs that have players with position "Right Wing".
|
SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2.Position = "Right Wing"
|
[
"SELECT",
"T1.name",
"FROM",
"club",
"AS",
"T1",
"JOIN",
"player",
"AS",
"T2",
"ON",
"T1.Club_ID",
"=",
"T2.Club_ID",
"WHERE",
"T2.Position",
"=",
"``",
"Right",
"Wing",
"''"
] |
[
"select",
"t1",
".",
"name",
"from",
"club",
"as",
"t1",
"join",
"player",
"as",
"t2",
"on",
"t1",
".",
"club_id",
"=",
"t2",
".",
"club_id",
"where",
"t2",
".",
"position",
"=",
"value"
] |
[
"Show",
"the",
"names",
"of",
"clubs",
"that",
"have",
"players",
"with",
"position",
"``",
"Right",
"Wing",
"''",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the names of the clubs that have players in the position of "Right Wing"?
|
SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2.Position = "Right Wing"
|
[
"SELECT",
"T1.name",
"FROM",
"club",
"AS",
"T1",
"JOIN",
"player",
"AS",
"T2",
"ON",
"T1.Club_ID",
"=",
"T2.Club_ID",
"WHERE",
"T2.Position",
"=",
"``",
"Right",
"Wing",
"''"
] |
[
"select",
"t1",
".",
"name",
"from",
"club",
"as",
"t1",
"join",
"player",
"as",
"t2",
"on",
"t1",
".",
"club_id",
"=",
"t2",
".",
"club_id",
"where",
"t2",
".",
"position",
"=",
"value"
] |
[
"What",
"are",
"the",
"names",
"of",
"the",
"clubs",
"that",
"have",
"players",
"in",
"the",
"position",
"of",
"``",
"Right",
"Wing",
"''",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What is the average points of players from club with name "AIB".
|
SELECT avg(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.name = "AIB"
|
[
"SELECT",
"avg",
"(",
"T2.Points",
")",
"FROM",
"club",
"AS",
"T1",
"JOIN",
"player",
"AS",
"T2",
"ON",
"T1.Club_ID",
"=",
"T2.Club_ID",
"WHERE",
"T1.name",
"=",
"``",
"AIB",
"''"
] |
[
"select",
"avg",
"(",
"t2",
".",
"points",
")",
"from",
"club",
"as",
"t1",
"join",
"player",
"as",
"t2",
"on",
"t1",
".",
"club_id",
"=",
"t2",
".",
"club_id",
"where",
"t1",
".",
"name",
"=",
"value"
] |
[
"What",
"is",
"the",
"average",
"points",
"of",
"players",
"from",
"club",
"with",
"name",
"``",
"AIB",
"''",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What is the average number of points for players from the "AIB" club?
|
SELECT avg(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.name = "AIB"
|
[
"SELECT",
"avg",
"(",
"T2.Points",
")",
"FROM",
"club",
"AS",
"T1",
"JOIN",
"player",
"AS",
"T2",
"ON",
"T1.Club_ID",
"=",
"T2.Club_ID",
"WHERE",
"T1.name",
"=",
"``",
"AIB",
"''"
] |
[
"select",
"avg",
"(",
"t2",
".",
"points",
")",
"from",
"club",
"as",
"t1",
"join",
"player",
"as",
"t2",
"on",
"t1",
".",
"club_id",
"=",
"t2",
".",
"club_id",
"where",
"t1",
".",
"name",
"=",
"value"
] |
[
"What",
"is",
"the",
"average",
"number",
"of",
"points",
"for",
"players",
"from",
"the",
"``",
"AIB",
"''",
"club",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
List the position of players and the average number of points of players of each position.
|
SELECT POSITION , avg(Points) FROM player GROUP BY POSITION
|
[
"SELECT",
"POSITION",
",",
"avg",
"(",
"Points",
")",
"FROM",
"player",
"GROUP",
"BY",
"POSITION"
] |
[
"select",
"position",
",",
"avg",
"(",
"points",
")",
"from",
"player",
"group",
"by",
"position"
] |
[
"List",
"the",
"position",
"of",
"players",
"and",
"the",
"average",
"number",
"of",
"points",
"of",
"players",
"of",
"each",
"position",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
For each position, what is the average number of points for players in that position?
|
SELECT POSITION , avg(Points) FROM player GROUP BY POSITION
|
[
"SELECT",
"POSITION",
",",
"avg",
"(",
"Points",
")",
"FROM",
"player",
"GROUP",
"BY",
"POSITION"
] |
[
"select",
"position",
",",
"avg",
"(",
"points",
")",
"from",
"player",
"group",
"by",
"position"
] |
[
"For",
"each",
"position",
",",
"what",
"is",
"the",
"average",
"number",
"of",
"points",
"for",
"players",
"in",
"that",
"position",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
List the position of players with average number of points scored by players of that position bigger than 20.
|
SELECT POSITION FROM player GROUP BY name HAVING avg(Points) >= 20
|
[
"SELECT",
"POSITION",
"FROM",
"player",
"GROUP",
"BY",
"name",
"HAVING",
"avg",
"(",
"Points",
")",
">",
"=",
"20"
] |
[
"select",
"position",
"from",
"player",
"group",
"by",
"name",
"having",
"avg",
"(",
"points",
")",
">",
"=",
"value"
] |
[
"List",
"the",
"position",
"of",
"players",
"with",
"average",
"number",
"of",
"points",
"scored",
"by",
"players",
"of",
"that",
"position",
"bigger",
"than",
"20",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the positions of players whose average number of points scored by that position is larger than 20?
|
SELECT POSITION FROM player GROUP BY name HAVING avg(Points) >= 20
|
[
"SELECT",
"POSITION",
"FROM",
"player",
"GROUP",
"BY",
"name",
"HAVING",
"avg",
"(",
"Points",
")",
">",
"=",
"20"
] |
[
"select",
"position",
"from",
"player",
"group",
"by",
"name",
"having",
"avg",
"(",
"points",
")",
">",
"=",
"value"
] |
[
"What",
"are",
"the",
"positions",
"of",
"players",
"whose",
"average",
"number",
"of",
"points",
"scored",
"by",
"that",
"position",
"is",
"larger",
"than",
"20",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
List the types of competition and the number of competitions of each type.
|
SELECT Competition_type , COUNT(*) FROM competition GROUP BY Competition_type
|
[
"SELECT",
"Competition_type",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"competition",
"GROUP",
"BY",
"Competition_type"
] |
[
"select",
"competition_type",
",",
"count",
"(",
"*",
")",
"from",
"competition",
"group",
"by",
"competition_type"
] |
[
"List",
"the",
"types",
"of",
"competition",
"and",
"the",
"number",
"of",
"competitions",
"of",
"each",
"type",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the types of competition and number of competitions for that type?
|
SELECT Competition_type , COUNT(*) FROM competition GROUP BY Competition_type
|
[
"SELECT",
"Competition_type",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"competition",
"GROUP",
"BY",
"Competition_type"
] |
[
"select",
"competition_type",
",",
"count",
"(",
"*",
")",
"from",
"competition",
"group",
"by",
"competition_type"
] |
[
"What",
"are",
"the",
"types",
"of",
"competition",
"and",
"number",
"of",
"competitions",
"for",
"that",
"type",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
List the most common type of competition.
|
SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1
|
[
"SELECT",
"Competition_type",
"FROM",
"competition",
"GROUP",
"BY",
"Competition_type",
"ORDER",
"BY",
"COUNT",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"competition_type",
"from",
"competition",
"group",
"by",
"competition_type",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"List",
"the",
"most",
"common",
"type",
"of",
"competition",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What is the most common competition type?
|
SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1
|
[
"SELECT",
"Competition_type",
"FROM",
"competition",
"GROUP",
"BY",
"Competition_type",
"ORDER",
"BY",
"COUNT",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"competition_type",
"from",
"competition",
"group",
"by",
"competition_type",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"What",
"is",
"the",
"most",
"common",
"competition",
"type",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
List the types of competition that have at most five competitions of that type.
|
SELECT Competition_type FROM competition GROUP BY Competition_type HAVING COUNT(*) <= 5
|
[
"SELECT",
"Competition_type",
"FROM",
"competition",
"GROUP",
"BY",
"Competition_type",
"HAVING",
"COUNT",
"(",
"*",
")",
"<",
"=",
"5"
] |
[
"select",
"competition_type",
"from",
"competition",
"group",
"by",
"competition_type",
"having",
"count",
"(",
"*",
")",
"<",
"=",
"value"
] |
[
"List",
"the",
"types",
"of",
"competition",
"that",
"have",
"at",
"most",
"five",
"competitions",
"of",
"that",
"type",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the types of competition that have most 5 competitions for that type?
|
SELECT Competition_type FROM competition GROUP BY Competition_type HAVING COUNT(*) <= 5
|
[
"SELECT",
"Competition_type",
"FROM",
"competition",
"GROUP",
"BY",
"Competition_type",
"HAVING",
"COUNT",
"(",
"*",
")",
"<",
"=",
"5"
] |
[
"select",
"competition_type",
"from",
"competition",
"group",
"by",
"competition_type",
"having",
"count",
"(",
"*",
")",
"<",
"=",
"value"
] |
[
"What",
"are",
"the",
"types",
"of",
"competition",
"that",
"have",
"most",
"5",
"competitions",
"for",
"that",
"type",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
List the names of clubs that do not have any players.
|
SELECT name FROM CLub WHERE Club_ID NOT IN (SELECT Club_ID FROM player)
|
[
"SELECT",
"name",
"FROM",
"CLub",
"WHERE",
"Club_ID",
"NOT",
"IN",
"(",
"SELECT",
"Club_ID",
"FROM",
"player",
")"
] |
[
"select",
"name",
"from",
"club",
"where",
"club_id",
"not",
"in",
"(",
"select",
"club_id",
"from",
"player",
")"
] |
[
"List",
"the",
"names",
"of",
"clubs",
"that",
"do",
"not",
"have",
"any",
"players",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the names of all clubs that do not have any players?
|
SELECT name FROM CLub WHERE Club_ID NOT IN (SELECT Club_ID FROM player)
|
[
"SELECT",
"name",
"FROM",
"CLub",
"WHERE",
"Club_ID",
"NOT",
"IN",
"(",
"SELECT",
"Club_ID",
"FROM",
"player",
")"
] |
[
"select",
"name",
"from",
"club",
"where",
"club_id",
"not",
"in",
"(",
"select",
"club_id",
"from",
"player",
")"
] |
[
"What",
"are",
"the",
"names",
"of",
"all",
"clubs",
"that",
"do",
"not",
"have",
"any",
"players",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the positions with both players having more than 20 points and less than 10 points.
|
SELECT POSITION FROM player WHERE Points > 20 INTERSECT SELECT POSITION FROM player WHERE Points < 10
|
[
"SELECT",
"POSITION",
"FROM",
"player",
"WHERE",
"Points",
">",
"20",
"INTERSECT",
"SELECT",
"POSITION",
"FROM",
"player",
"WHERE",
"Points",
"<",
"10"
] |
[
"select",
"position",
"from",
"player",
"where",
"points",
">",
"value",
"intersect",
"select",
"position",
"from",
"player",
"where",
"points",
"<",
"value"
] |
[
"What",
"are",
"the",
"positions",
"with",
"both",
"players",
"having",
"more",
"than",
"20",
"points",
"and",
"less",
"than",
"10",
"points",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the positions of both players that have more than 20 20 points and less than 10 points?
|
SELECT POSITION FROM player WHERE Points > 20 INTERSECT SELECT POSITION FROM player WHERE Points < 10
|
[
"SELECT",
"POSITION",
"FROM",
"player",
"WHERE",
"Points",
">",
"20",
"INTERSECT",
"SELECT",
"POSITION",
"FROM",
"player",
"WHERE",
"Points",
"<",
"10"
] |
[
"select",
"position",
"from",
"player",
"where",
"points",
">",
"value",
"intersect",
"select",
"position",
"from",
"player",
"where",
"points",
"<",
"value"
] |
[
"What",
"are",
"the",
"positions",
"of",
"both",
"players",
"that",
"have",
"more",
"than",
"20",
"20",
"points",
"and",
"less",
"than",
"10",
"points",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
Show total points of all players.
|
SELECT sum(Points) FROM player
|
[
"SELECT",
"sum",
"(",
"Points",
")",
"FROM",
"player"
] |
[
"select",
"sum",
"(",
"points",
")",
"from",
"player"
] |
[
"Show",
"total",
"points",
"of",
"all",
"players",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What is the total number of points for all players?
|
SELECT sum(Points) FROM player
|
[
"SELECT",
"sum",
"(",
"Points",
")",
"FROM",
"player"
] |
[
"select",
"sum",
"(",
"points",
")",
"from",
"player"
] |
[
"What",
"is",
"the",
"total",
"number",
"of",
"points",
"for",
"all",
"players",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
how many different positions are there?
|
SELECT count(DISTINCT POSITION) FROM player
|
[
"SELECT",
"count",
"(",
"DISTINCT",
"POSITION",
")",
"FROM",
"player"
] |
[
"select",
"count",
"(",
"distinct",
"position",
")",
"from",
"player"
] |
[
"how",
"many",
"different",
"positions",
"are",
"there",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
How many different position for players are listed?
|
SELECT count(DISTINCT POSITION) FROM player
|
[
"SELECT",
"count",
"(",
"DISTINCT",
"POSITION",
")",
"FROM",
"player"
] |
[
"select",
"count",
"(",
"distinct",
"position",
")",
"from",
"player"
] |
[
"How",
"many",
"different",
"position",
"for",
"players",
"are",
"listed",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
what are the name of players who get more than the average points.
|
SELECT name FROM player WHERE points > (SELECT avg(points) FROM player)
|
[
"SELECT",
"name",
"FROM",
"player",
"WHERE",
"points",
">",
"(",
"SELECT",
"avg",
"(",
"points",
")",
"FROM",
"player",
")"
] |
[
"select",
"name",
"from",
"player",
"where",
"points",
">",
"(",
"select",
"avg",
"(",
"points",
")",
"from",
"player",
")"
] |
[
"what",
"are",
"the",
"name",
"of",
"players",
"who",
"get",
"more",
"than",
"the",
"average",
"points",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the names of all players that got more than the average number of points?
|
SELECT name FROM player WHERE points > (SELECT avg(points) FROM player)
|
[
"SELECT",
"name",
"FROM",
"player",
"WHERE",
"points",
">",
"(",
"SELECT",
"avg",
"(",
"points",
")",
"FROM",
"player",
")"
] |
[
"select",
"name",
"from",
"player",
"where",
"points",
">",
"(",
"select",
"avg",
"(",
"points",
")",
"from",
"player",
")"
] |
[
"What",
"are",
"the",
"names",
"of",
"all",
"players",
"that",
"got",
"more",
"than",
"the",
"average",
"number",
"of",
"points",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
find the number of players whose points are lower than 30 in each position.
|
SELECT count(*) , POSITION FROM player WHERE points < 30 GROUP BY POSITION
|
[
"SELECT",
"count",
"(",
"*",
")",
",",
"POSITION",
"FROM",
"player",
"WHERE",
"points",
"<",
"30",
"GROUP",
"BY",
"POSITION"
] |
[
"select",
"count",
"(",
"*",
")",
",",
"position",
"from",
"player",
"where",
"points",
"<",
"value",
"group",
"by",
"position"
] |
[
"find",
"the",
"number",
"of",
"players",
"whose",
"points",
"are",
"lower",
"than",
"30",
"in",
"each",
"position",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What is the number of players who have points less than 30 for each position?
|
SELECT count(*) , POSITION FROM player WHERE points < 30 GROUP BY POSITION
|
[
"SELECT",
"count",
"(",
"*",
")",
",",
"POSITION",
"FROM",
"player",
"WHERE",
"points",
"<",
"30",
"GROUP",
"BY",
"POSITION"
] |
[
"select",
"count",
"(",
"*",
")",
",",
"position",
"from",
"player",
"where",
"points",
"<",
"value",
"group",
"by",
"position"
] |
[
"What",
"is",
"the",
"number",
"of",
"players",
"who",
"have",
"points",
"less",
"than",
"30",
"for",
"each",
"position",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
which country did participated in the most number of Tournament competitions?
|
SELECT country FROM competition WHERE competition_type = 'Tournament' GROUP BY country ORDER BY count(*) DESC LIMIT 1
|
[
"SELECT",
"country",
"FROM",
"competition",
"WHERE",
"competition_type",
"=",
"'Tournament",
"'",
"GROUP",
"BY",
"country",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"country",
"from",
"competition",
"where",
"competition_type",
"=",
"value",
"group",
"by",
"country",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"which",
"country",
"did",
"participated",
"in",
"the",
"most",
"number",
"of",
"Tournament",
"competitions",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
what is the name of the country that participated in the most tournament competitions?
|
SELECT country FROM competition WHERE competition_type = 'Tournament' GROUP BY country ORDER BY count(*) DESC LIMIT 1
|
[
"SELECT",
"country",
"FROM",
"competition",
"WHERE",
"competition_type",
"=",
"'Tournament",
"'",
"GROUP",
"BY",
"country",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"country",
"from",
"competition",
"where",
"competition_type",
"=",
"value",
"group",
"by",
"country",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"what",
"is",
"the",
"name",
"of",
"the",
"country",
"that",
"participated",
"in",
"the",
"most",
"tournament",
"competitions",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
which countries did participated in both Friendly and Tournament type competitions.
|
SELECT country FROM competition WHERE competition_type = 'Friendly' INTERSECT SELECT country FROM competition WHERE competition_type = 'Tournament'
|
[
"SELECT",
"country",
"FROM",
"competition",
"WHERE",
"competition_type",
"=",
"'Friendly",
"'",
"INTERSECT",
"SELECT",
"country",
"FROM",
"competition",
"WHERE",
"competition_type",
"=",
"'Tournament",
"'"
] |
[
"select",
"country",
"from",
"competition",
"where",
"competition_type",
"=",
"value",
"intersect",
"select",
"country",
"from",
"competition",
"where",
"competition_type",
"=",
"value"
] |
[
"which",
"countries",
"did",
"participated",
"in",
"both",
"Friendly",
"and",
"Tournament",
"type",
"competitions",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the countries that participated in both friendly and tournament type competitions?
|
SELECT country FROM competition WHERE competition_type = 'Friendly' INTERSECT SELECT country FROM competition WHERE competition_type = 'Tournament'
|
[
"SELECT",
"country",
"FROM",
"competition",
"WHERE",
"competition_type",
"=",
"'Friendly",
"'",
"INTERSECT",
"SELECT",
"country",
"FROM",
"competition",
"WHERE",
"competition_type",
"=",
"'Tournament",
"'"
] |
[
"select",
"country",
"from",
"competition",
"where",
"competition_type",
"=",
"value",
"intersect",
"select",
"country",
"from",
"competition",
"where",
"competition_type",
"=",
"value"
] |
[
"What",
"are",
"the",
"countries",
"that",
"participated",
"in",
"both",
"friendly",
"and",
"tournament",
"type",
"competitions",
"?"
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
Find the countries that have never participated in any competition with Friendly type.
|
SELECT country FROM competition EXCEPT SELECT country FROM competition WHERE competition_type = 'Friendly'
|
[
"SELECT",
"country",
"FROM",
"competition",
"EXCEPT",
"SELECT",
"country",
"FROM",
"competition",
"WHERE",
"competition_type",
"=",
"'Friendly",
"'"
] |
[
"select",
"country",
"from",
"competition",
"except",
"select",
"country",
"from",
"competition",
"where",
"competition_type",
"=",
"value"
] |
[
"Find",
"the",
"countries",
"that",
"have",
"never",
"participated",
"in",
"any",
"competition",
"with",
"Friendly",
"type",
"."
] |
sports_competition
|
[
"CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);",
"CREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);",
"CREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);",
"CREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);"
] |
What are the countries that have never participated in any friendly-type competitions?
|
SELECT country FROM competition EXCEPT SELECT country FROM competition WHERE competition_type = 'Friendly'
|
[
"SELECT",
"country",
"FROM",
"competition",
"EXCEPT",
"SELECT",
"country",
"FROM",
"competition",
"WHERE",
"competition_type",
"=",
"'Friendly",
"'"
] |
[
"select",
"country",
"from",
"competition",
"except",
"select",
"country",
"from",
"competition",
"where",
"competition_type",
"=",
"value"
] |
[
"What",
"are",
"the",
"countries",
"that",
"have",
"never",
"participated",
"in",
"any",
"friendly-type",
"competitions",
"?"
] |
manufacturer
|
[
"CREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);",
"CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);",
"CREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);"
] |
How many furniture components are there in total?
|
SELECT sum(num_of_component) FROM furniture
|
[
"SELECT",
"sum",
"(",
"num_of_component",
")",
"FROM",
"furniture"
] |
[
"select",
"sum",
"(",
"num_of_component",
")",
"from",
"furniture"
] |
[
"How",
"many",
"furniture",
"components",
"are",
"there",
"in",
"total",
"?"
] |
manufacturer
|
[
"CREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);",
"CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);",
"CREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);"
] |
Return the name and id of the furniture with the highest market rate.
|
SELECT name , furniture_id FROM furniture ORDER BY market_rate DESC LIMIT 1
|
[
"SELECT",
"name",
",",
"furniture_id",
"FROM",
"furniture",
"ORDER",
"BY",
"market_rate",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"name",
",",
"furniture_id",
"from",
"furniture",
"order",
"by",
"market_rate",
"desc",
"limit",
"value"
] |
[
"Return",
"the",
"name",
"and",
"id",
"of",
"the",
"furniture",
"with",
"the",
"highest",
"market",
"rate",
"."
] |
manufacturer
|
[
"CREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);",
"CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);",
"CREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);"
] |
find the total market rate of the furnitures that have the top 2 market shares.
|
SELECT sum(market_rate) FROM furniture ORDER BY market_rate DESC LIMIT 2
|
[
"SELECT",
"sum",
"(",
"market_rate",
")",
"FROM",
"furniture",
"ORDER",
"BY",
"market_rate",
"DESC",
"LIMIT",
"2"
] |
[
"select",
"sum",
"(",
"market_rate",
")",
"from",
"furniture",
"order",
"by",
"market_rate",
"desc",
"limit",
"value"
] |
[
"find",
"the",
"total",
"market",
"rate",
"of",
"the",
"furnitures",
"that",
"have",
"the",
"top",
"2",
"market",
"shares",
"."
] |
manufacturer
|
[
"CREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);",
"CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);",
"CREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);"
] |
Find the component amounts and names of all furnitures that have more than 10 components.
|
SELECT Num_of_Component , name FROM furniture WHERE Num_of_Component > 10
|
[
"SELECT",
"Num_of_Component",
",",
"name",
"FROM",
"furniture",
"WHERE",
"Num_of_Component",
">",
"10"
] |
[
"select",
"num_of_component",
",",
"name",
"from",
"furniture",
"where",
"num_of_component",
">",
"value"
] |
[
"Find",
"the",
"component",
"amounts",
"and",
"names",
"of",
"all",
"furnitures",
"that",
"have",
"more",
"than",
"10",
"components",
"."
] |
manufacturer
|
[
"CREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);",
"CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);",
"CREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);"
] |
Find the name and component amount of the least popular furniture.
|
SELECT name , Num_of_Component FROM furniture ORDER BY market_rate LIMIT 1
|
[
"SELECT",
"name",
",",
"Num_of_Component",
"FROM",
"furniture",
"ORDER",
"BY",
"market_rate",
"LIMIT",
"1"
] |
[
"select",
"name",
",",
"num_of_component",
"from",
"furniture",
"order",
"by",
"market_rate",
"limit",
"value"
] |
[
"Find",
"the",
"name",
"and",
"component",
"amount",
"of",
"the",
"least",
"popular",
"furniture",
"."
] |
manufacturer
|
[
"CREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);",
"CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);",
"CREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);"
] |
Find the names of furnitures whose prices are lower than the highest price.
|
SELECT t1.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID WHERE t2.Price_in_Dollar < (SELECT max(Price_in_Dollar) FROM furniture_manufacte)
|
[
"SELECT",
"t1.name",
"FROM",
"furniture",
"AS",
"t1",
"JOIN",
"furniture_manufacte",
"AS",
"t2",
"ON",
"t1.Furniture_ID",
"=",
"t2.Furniture_ID",
"WHERE",
"t2.Price_in_Dollar",
"<",
"(",
"SELECT",
"max",
"(",
"Price_in_Dollar",
")",
"FROM",
"furniture_manufacte",
")"
] |
[
"select",
"t1",
".",
"name",
"from",
"furniture",
"as",
"t1",
"join",
"furniture_manufacte",
"as",
"t2",
"on",
"t1",
".",
"furniture_id",
"=",
"t2",
".",
"furniture_id",
"where",
"t2",
".",
"price_in_dollar",
"<",
"(",
"select",
"max",
"(",
"price_in_dollar",
")",
"from",
"furniture_manufacte",
")"
] |
[
"Find",
"the",
"names",
"of",
"furnitures",
"whose",
"prices",
"are",
"lower",
"than",
"the",
"highest",
"price",
"."
] |
manufacturer
|
[
"CREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);",
"CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);",
"CREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);"
] |
Which manufacturer has the most number of shops? List its name and year of opening.
|
SELECT open_year , name FROM manufacturer ORDER BY num_of_shops DESC LIMIT 1
|
[
"SELECT",
"open_year",
",",
"name",
"FROM",
"manufacturer",
"ORDER",
"BY",
"num_of_shops",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"open_year",
",",
"name",
"from",
"manufacturer",
"order",
"by",
"num_of_shops",
"desc",
"limit",
"value"
] |
[
"Which",
"manufacturer",
"has",
"the",
"most",
"number",
"of",
"shops",
"?",
"List",
"its",
"name",
"and",
"year",
"of",
"opening",
"."
] |
manufacturer
|
[
"CREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);",
"CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);",
"CREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);"
] |
Find the average number of factories for the manufacturers that have more than 20 shops.
|
SELECT avg(Num_of_Factories) FROM manufacturer WHERE num_of_shops > 20
|
[
"SELECT",
"avg",
"(",
"Num_of_Factories",
")",
"FROM",
"manufacturer",
"WHERE",
"num_of_shops",
">",
"20"
] |
[
"select",
"avg",
"(",
"num_of_factories",
")",
"from",
"manufacturer",
"where",
"num_of_shops",
">",
"value"
] |
[
"Find",
"the",
"average",
"number",
"of",
"factories",
"for",
"the",
"manufacturers",
"that",
"have",
"more",
"than",
"20",
"shops",
"."
] |
manufacturer
|
[
"CREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);",
"CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);",
"CREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);"
] |
List all manufacturer names and ids ordered by their opening year.
|
SELECT name , manufacturer_id FROM manufacturer ORDER BY open_year
|
[
"SELECT",
"name",
",",
"manufacturer_id",
"FROM",
"manufacturer",
"ORDER",
"BY",
"open_year"
] |
[
"select",
"name",
",",
"manufacturer_id",
"from",
"manufacturer",
"order",
"by",
"open_year"
] |
[
"List",
"all",
"manufacturer",
"names",
"and",
"ids",
"ordered",
"by",
"their",
"opening",
"year",
"."
] |
manufacturer
|
[
"CREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);",
"CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);",
"CREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);"
] |
Give me the name and year of opening of the manufacturers that have either less than 10 factories or more than 10 shops.
|
SELECT name , open_year FROM manufacturer WHERE num_of_shops > 10 OR Num_of_Factories < 10
|
[
"SELECT",
"name",
",",
"open_year",
"FROM",
"manufacturer",
"WHERE",
"num_of_shops",
">",
"10",
"OR",
"Num_of_Factories",
"<",
"10"
] |
[
"select",
"name",
",",
"open_year",
"from",
"manufacturer",
"where",
"num_of_shops",
">",
"value",
"or",
"num_of_factories",
"<",
"value"
] |
[
"Give",
"me",
"the",
"name",
"and",
"year",
"of",
"opening",
"of",
"the",
"manufacturers",
"that",
"have",
"either",
"less",
"than",
"10",
"factories",
"or",
"more",
"than",
"10",
"shops",
"."
] |
manufacturer
|
[
"CREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);",
"CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);",
"CREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);"
] |
what is the average number of factories and maximum number of shops for manufacturers that opened before 1990.
|
SELECT max(num_of_shops) , avg(Num_of_Factories) FROM manufacturer WHERE open_year < 1990
|
[
"SELECT",
"max",
"(",
"num_of_shops",
")",
",",
"avg",
"(",
"Num_of_Factories",
")",
"FROM",
"manufacturer",
"WHERE",
"open_year",
"<",
"1990"
] |
[
"select",
"max",
"(",
"num_of_shops",
")",
",",
"avg",
"(",
"num_of_factories",
")",
"from",
"manufacturer",
"where",
"open_year",
"<",
"value"
] |
[
"what",
"is",
"the",
"average",
"number",
"of",
"factories",
"and",
"maximum",
"number",
"of",
"shops",
"for",
"manufacturers",
"that",
"opened",
"before",
"1990",
"."
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.