NATURAL_LANG stringlengths 12 244 | SQL stringlengths 18 336 | SCHEMA stringlengths 27 355 | input_ids list | attention_mask list | labels list |
|---|---|---|---|---|---|
Find the number of classes in each department. | SELECT COUNT(*), dept_code FROM CLASS AS T1 JOIN course AS T2 ON T1.crs_code = T2.crs_code GROUP BY dept_code | CREATE TABLE CLASS (crs_code VARCHAR); CREATE TABLE course (crs_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
75,
52,
7,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
503,
41,
75,
52,
7,
834,
4978,
584,
4280,
28027,
61,
3,
32102,
32106,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
201,
20,
102,
17,
834,
4978,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
503,
6157,
332,
357,
9191,
332,
5411,
75,
52,
7,
834,
4978,
3274,
332,
4416,
75,
52,
7,
834,
4978,
350,
4630,
... |
Find the number of classes in each school. | SELECT COUNT(*), T3.school_code FROM CLASS AS T1 JOIN course AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T2.dept_code = T3.dept_code GROUP BY T3.school_code | CREATE TABLE department (school_code VARCHAR, dept_code VARCHAR); CREATE TABLE CLASS (crs_code VARCHAR); CREATE TABLE course (crs_code VARCHAR, dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3066,
41,
6646,
834,
4978,
584,
4280,
28027,
6,
20,
102,
17,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
75,
52,
7,
834,
4978,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
201,
332,
5787,
6646,
834,
4978,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
503,
6157,
332,
357,
9191,
332,
5411,
75,
52,
7,
834,
4978,
3274,
332,
4416,
75,
52,
7,
834,
4978,
3,
15355... |
What is the number of professors for different school? | SELECT COUNT(*), T1.school_code FROM department AS T1 JOIN professor AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.school_code | CREATE TABLE department (school_code VARCHAR, dept_code VARCHAR); CREATE TABLE professor (dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3066,
41,
6646,
834,
4978,
584,
4280,
28027,
6,
20,
102,
17,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
5812,
41,
26,
6707,
834,
4978,
584,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
201,
332,
5411,
6646,
834,
4978,
21680,
3066,
6157,
332,
536,
3,
15355,
3162,
5812,
6157,
332,
357,
9191,
332,
5411,
26,
6707,
834,
4978,
3274,
332,
4416,
26,
6707,
834,
4978,
350,
4630,
6880,
... |
Find the count and code of the job has most employees. | SELECT emp_jobcode, COUNT(*) FROM employee GROUP BY emp_jobcode ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE employee (emp_jobcode VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3490,
41,
15,
1167,
834,
16899,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
2588,
8,
3476,
11,
1081,
13,
8,
613,
65,
167,
1652,
5,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
8943,
834,
16899,
4978,
6,
2847,
17161,
599,
1935,
61,
21680,
3490,
350,
4630,
6880,
272,
476,
8943,
834,
16899,
4978,
4674,
11300,
272,
476,
2847,
17161,
599,
1935,
61,
309,
25067,
8729,
12604,
209,
1,
-100,
-100,
-1... |
Which school has the smallest amount of professors? | SELECT T1.school_code FROM department AS T1 JOIN professor AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.school_code ORDER BY COUNT(*) LIMIT 1 | CREATE TABLE department (school_code VARCHAR, dept_code VARCHAR); CREATE TABLE professor (dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3066,
41,
6646,
834,
4978,
584,
4280,
28027,
6,
20,
102,
17,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
5812,
41,
26,
6707,
834,
4978,
584,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0... | [
3,
23143,
14196,
332,
5411,
6646,
834,
4978,
21680,
3066,
6157,
332,
536,
3,
15355,
3162,
5812,
6157,
332,
357,
9191,
332,
5411,
26,
6707,
834,
4978,
3274,
332,
4416,
26,
6707,
834,
4978,
350,
4630,
6880,
272,
476,
332,
5411,
6646,
... |
Find the number of professors with a Ph.D. degree in each department. | SELECT COUNT(*), dept_code FROM professor WHERE prof_high_degree = 'Ph.D.' GROUP BY dept_code | CREATE TABLE professor (dept_code VARCHAR, prof_high_degree VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
5812,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
6,
7108,
834,
6739,
834,
19706,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
2588,
8,
381,
13,
5812,
7,
28,
3,
9,
3657,
5,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
201,
20,
102,
17,
834,
4978,
21680,
5812,
549,
17444,
427,
7108,
834,
6739,
834,
19706,
3274,
3,
31,
345,
107,
5,
308,
5,
31,
350,
4630,
6880,
272,
476,
20,
102,
17,
834,
4978,
1,
-100,
-... |
Find the number of students for each department. | SELECT COUNT(*), dept_code FROM student GROUP BY dept_code | CREATE TABLE student (dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1236,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
2588,
8,
381,
13,
481,
21,
284,
3066,
5,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
201,
20,
102,
17,
834,
4978,
21680,
1236,
350,
4630,
6880,
272,
476,
20,
102,
17,
834,
4978,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
Find the total number of hours have done for all students in each department. | SELECT SUM(stu_hrs), dept_code FROM student GROUP BY dept_code | CREATE TABLE student (dept_code VARCHAR, stu_hrs INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1236,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
6,
21341,
834,
18745,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
2588,
8,
792,
381,
13,
716,
43,
612,
21,
66,
481,
16,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
180,
6122,
599,
7,
17,
76,
834,
18745,
201,
20,
102,
17,
834,
4978,
21680,
1236,
350,
4630,
6880,
272,
476,
20,
102,
17,
834,
4978,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
Find the max, average, and minimum gpa of all students in each department. | SELECT MAX(stu_gpa), AVG(stu_gpa), MIN(stu_gpa), dept_code FROM student GROUP BY dept_code | CREATE TABLE student (dept_code VARCHAR, stu_gpa INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1236,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
6,
21341,
834,
122,
102,
9,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
2588,
8,
9858,
6,
1348,
6,
11,
2559,
3,
122,
102,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
4800,
4,
599,
7,
17,
76,
834,
122,
102,
9,
201,
71,
17217,
599,
7,
17,
76,
834,
122,
102,
9,
201,
3,
17684,
599,
7,
17,
76,
834,
122,
102,
9,
201,
20,
102,
17,
834,
4978,
21680,
1236,
350,
4630,
6880,
272,
... |
What is the name and the average gpa of department whose students have the highest average gpa? | SELECT T2.dept_name, AVG(T1.stu_gpa) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY AVG(T1.stu_gpa) DESC LIMIT 1 | CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR); CREATE TABLE student (stu_gpa INTEGER, dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4350,
584,
4280,
28027,
6,
20,
102,
17,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
1236,
41,
7,
17,
76,
834,
122,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
26,
6707,
834,
4350,
6,
71,
17217,
599,
382,
5411,
7,
17,
76,
834,
122,
102,
9,
61,
21680,
1236,
6157,
332,
536,
3,
15355,
3162,
3066,
6157,
332,
357,
9191,
332,
5411,
26,
6707,
834,
4978,
3274,
332,
... |
how many schools exist in total? | SELECT COUNT(DISTINCT school_code) FROM department | CREATE TABLE department (school_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3066,
41,
6646,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
149,
186,
2061,
3223,
16,
792,
58,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
15438,
25424,
6227,
496,
834,
4978,
61,
21680,
3066,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
How many different classes are there? | SELECT COUNT(DISTINCT class_code) FROM CLASS | CREATE TABLE CLASS (class_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
4057,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
571,
186,
315,
2287,
33,
132,
58,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
15438,
25424,
6227,
853,
834,
4978,
61,
21680,
3,
31598,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
How many courses are offered? | SELECT COUNT(DISTINCT crs_code) FROM CLASS | CREATE TABLE CLASS (crs_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
75,
52,
7,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
571,
186,
2996,
33,
1860,
58,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
15438,
25424,
6227,
5764,
7,
834,
4978,
61,
21680,
3,
31598,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,... |
How many departments does the college has? | SELECT COUNT(DISTINCT dept_name) FROM department | CREATE TABLE department (dept_name VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4350,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
571,
186,
10521,
405,
8,
1900,
65,
58,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
15438,
25424,
6227,
20,
102,
17,
834,
4350,
61,
21680,
3066,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,... |
How many courses are offered by the Computer Info. Systems department? | SELECT COUNT(*) FROM department AS T1 JOIN course AS T2 ON T1.dept_code = T2.dept_code WHERE dept_name = "Computer Info. Systems" | CREATE TABLE course (dept_code VARCHAR); CREATE TABLE department (dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
503,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
61,
3,
32102,
32106,
32107,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
61,
21680,
3066,
6157,
332,
536,
3,
15355,
3162,
503,
6157,
332,
357,
9191,
332,
5411,
26,
6707,
834,
4978,
3274,
332,
4416,
26,
6707,
834,
4978,
549,
17444,
427,
20,
102,
17,
834,
4350,
3274... |
How many sections does course ACCT-211 has? | SELECT COUNT(DISTINCT class_section) FROM CLASS WHERE crs_code = 'ACCT-211' | CREATE TABLE CLASS (class_section VARCHAR, crs_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
4057,
834,
14309,
584,
4280,
28027,
6,
5764,
7,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
571,
186,
6795,
405,
503,
5686,
6227,
18,
27278,
65,
58,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
15438,
25424,
6227,
853,
834,
14309,
61,
21680,
3,
31598,
549,
17444,
427,
5764,
7,
834,
4978,
3274,
3,
31,
14775,
382,
18,
27278,
31,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
Find the total credits of all classes offered by each department. | SELECT SUM(T1.crs_credit), T1.dept_code FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code GROUP BY T1.dept_code | CREATE TABLE CLASS (crs_code VARCHAR); CREATE TABLE course (dept_code VARCHAR, crs_credit INTEGER, crs_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
75,
52,
7,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
503,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
6,
5764,
7,
834,
15547,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
180,
6122,
599,
382,
5411,
75,
52,
7,
834,
15547,
201,
332,
5411,
26,
6707,
834,
4978,
21680,
503,
6157,
332,
536,
3,
15355,
3162,
3,
31598,
6157,
332,
357,
9191,
332,
5411,
75,
52,
7,
834,
4978,
3274,
332,
4416,
... |
Find the name of the department that offers the largest number of credits of all classes. | SELECT T3.dept_name FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T1.dept_code = T3.dept_code GROUP BY T1.dept_code ORDER BY SUM(T1.crs_credit) DESC LIMIT 1 | CREATE TABLE CLASS (crs_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR); CREATE TABLE course (dept_code VARCHAR, crs_code VARCHAR, crs_credit INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
75,
52,
7,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4350,
584,
4280,
28027,
6,
20,
102,
17,
834,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5787,
26,
6707,
834,
4350,
21680,
503,
6157,
332,
536,
3,
15355,
3162,
3,
31598,
6157,
332,
357,
9191,
332,
5411,
75,
52,
7,
834,
4978,
3274,
332,
4416,
75,
52,
7,
834,
4978,
3,
15355,
3162,
3066,
6157,
332,
... |
How many students enrolled in class ACCT-211? | SELECT COUNT(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code WHERE T1.crs_code = 'ACCT-211' | CREATE TABLE enroll (class_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
17990,
41,
4057,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
4057,
834,
4978,
584,
4280,
28027,
6,
5764,
7,
834,
4978,
584,
4280... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
61,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
17990,
6157,
332,
357,
9191,
332,
5411,
4057,
834,
4978,
3274,
332,
4416,
4057,
834,
4978,
549,
17444,
427,
332,
5411,
75,
52,
7,
834,
497... |
What is the first name of each student enrolled in class ACCT-211? | SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211' | CREATE TABLE student (stu_fname VARCHAR, stu_num VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE enroll (class_code VARCHAR, stu_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1236,
41,
7,
17,
76,
834,
89,
4350,
584,
4280,
28027,
6,
21341,
834,
5525,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
4057,
834,
4978,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5787,
7,
17,
76,
834,
89,
4350,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
17990,
6157,
332,
357,
9191,
332,
5411,
4057,
834,
4978,
3274,
332,
4416,
4057,
834,
4978,
3,
15355,
3162,
1236,
6157,
332,
519,
... |
What is the first name of students enrolled in class ACCT-211 and got grade C? | SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211' AND T2.enroll_grade = 'C' | CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_num VARCHAR); CREATE TABLE enroll (class_code VARCHAR, stu_num VARCHAR, enroll_grade VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
4057,
834,
4978,
584,
4280,
28027,
6,
5764,
7,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
1236,
41,
7,
17,
76,
834,
89,
4350,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5787,
7,
17,
76,
834,
89,
4350,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
17990,
6157,
332,
357,
9191,
332,
5411,
4057,
834,
4978,
3274,
332,
4416,
4057,
834,
4978,
3,
15355,
3162,
1236,
6157,
332,
519,
... |
Find the total number of employees. | SELECT COUNT(*) FROM employee | CREATE TABLE employee (Id VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3490,
41,
196,
26,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
2588,
8,
792,
381,
13,
1652,
5,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
61,
21680,
3490,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
How many professors do have a Ph.D. degree? | SELECT COUNT(*) FROM professor WHERE prof_high_degree = 'Ph.D.' | CREATE TABLE professor (prof_high_degree VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
5812,
41,
1409,
89,
834,
6739,
834,
19706,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
571,
186,
5812,
7,
103,
43,
3,
9,
3657,
5,
308,
5,
1952,
58,
1,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
61,
21680,
5812,
549,
17444,
427,
7108,
834,
6739,
834,
19706,
3274,
3,
31,
345,
107,
5,
308,
5,
31,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
How many students are enrolled in the class taught by some professor from the accounting department? | SELECT COUNT(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN department AS T4 ON T3.dept_code = T4.dept_code WHERE T4.dept_name = 'Accounting' | CREATE TABLE enroll (class_code VARCHAR); CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE course (crs_code VARCHAR, dept_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
17990,
41,
4057,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
6,
20,
102,
17,
834,
4350,
584,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
61,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
17990,
6157,
332,
357,
9191,
332,
5411,
4057,
834,
4978,
3274,
332,
4416,
4057,
834,
4978,
3,
15355,
3162,
503,
6157,
332,
519,
9191,
332,
... |
What is the name of the department that has the largest number of students enrolled? | SELECT T4.dept_name FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN department AS T4 ON T3.dept_code = T4.dept_code GROUP BY T3.dept_code ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE enroll (class_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE course (dept_code VARCHAR, crs_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
17990,
41,
4057,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
4057,
834,
4978,
584,
4280,
28027,
6,
5764,
7,
834,
4978,
584,
4280... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
7984,
26,
6707,
834,
4350,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
17990,
6157,
332,
357,
9191,
332,
5411,
4057,
834,
4978,
3274,
332,
4416,
4057,
834,
4978,
3,
15355,
3162,
503,
6157,
332,
519,
9191,
... |
list names of all departments ordered by their names. | SELECT dept_name FROM department ORDER BY dept_name | CREATE TABLE department (dept_name VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4350,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
570,
3056,
13,
66,
10521,
5563,
57,
70,
3056,
5,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
20,
102,
17,
834,
4350,
21680,
3066,
4674,
11300,
272,
476,
20,
102,
17,
834,
4350,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
List the codes of all courses that take place in room KLR209. | SELECT class_code FROM CLASS WHERE class_room = 'KLR209' | CREATE TABLE CLASS (class_code VARCHAR, class_room VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
4057,
834,
4978,
584,
4280,
28027,
6,
853,
834,
3082,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
6792,
8,
5633,
13,
66,
2996,
24,
240,
286,
16,
562,
480,
1256... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
853,
834,
4978,
21680,
3,
31598,
549,
17444,
427,
853,
834,
3082,
3274,
3,
31,
439,
12564,
357,
4198,
31,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
List the first name of all employees with job code PROF ordered by their date of birth. | SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob | CREATE TABLE employee (emp_fname VARCHAR, emp_jobcode VARCHAR, emp_dob VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3490,
41,
15,
1167,
834,
89,
4350,
584,
4280,
28027,
6,
8943,
834,
16899,
4978,
584,
4280,
28027,
6,
8943,
834,
26,
32,
115,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
6792,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0... | [
3,
23143,
14196,
8943,
834,
89,
4350,
21680,
3490,
549,
17444,
427,
8943,
834,
16899,
4978,
3274,
3,
31,
17618,
371,
31,
4674,
11300,
272,
476,
8943,
834,
26,
32,
115,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
Find the first names and offices of all professors sorted by alphabetical order of their first name. | SELECT T2.emp_fname, T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname | CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
5812,
41,
1409,
89,
834,
19632,
584,
4280,
28027,
6,
8943,
834,
5525,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3490,
41,
15,
1167,
834,
89,
4350,
584,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
15,
1167,
834,
89,
4350,
6,
332,
5411,
1409,
89,
834,
19632,
21680,
5812,
6157,
332,
536,
3,
15355,
3162,
3490,
6157,
332,
357,
9191,
332,
5411,
15,
1167,
834,
5525,
3274,
332,
4416,
15,
1167,
834,
5525,
... |
What is the first and last name of the oldest employee? | SELECT emp_fname, emp_lname FROM employee ORDER BY emp_dob LIMIT 1 | CREATE TABLE employee (emp_fname VARCHAR, emp_lname VARCHAR, emp_dob VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3490,
41,
15,
1167,
834,
89,
4350,
584,
4280,
28027,
6,
8943,
834,
40,
4350,
584,
4280,
28027,
6,
8943,
834,
26,
32,
115,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
363,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
8943,
834,
89,
4350,
6,
8943,
834,
40,
4350,
21680,
3490,
4674,
11300,
272,
476,
8943,
834,
26,
32,
115,
8729,
12604,
209,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
What is the first, last name, gpa of the youngest one among students whose GPA is above 3? | SELECT stu_fname, stu_lname, stu_gpa FROM student WHERE stu_gpa > 3 ORDER BY stu_dob DESC LIMIT 1 | CREATE TABLE student (stu_fname VARCHAR, stu_lname VARCHAR, stu_gpa INTEGER, stu_dob VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1236,
41,
7,
17,
76,
834,
89,
4350,
584,
4280,
28027,
6,
21341,
834,
40,
4350,
584,
4280,
28027,
6,
21341,
834,
122,
102,
9,
3,
21342,
17966,
6,
21341,
834,
26,
32,
115,
584,
4280,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
21341,
834,
89,
4350,
6,
21341,
834,
40,
4350,
6,
21341,
834,
122,
102,
9,
21680,
1236,
549,
17444,
427,
21341,
834,
122,
102,
9,
2490,
220,
4674,
11300,
272,
476,
21341,
834,
26,
32,
115,
309,
25067,
8729,
12604,
... |
What is the first name of students who got grade C in any class? | SELECT DISTINCT stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE enroll_grade = 'C' | CREATE TABLE student (stu_num VARCHAR); CREATE TABLE enroll (stu_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1236,
41,
7,
17,
76,
834,
5525,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
17990,
41,
7,
17,
76,
834,
5525,
584,
4280,
28027,
61,
3,
32102,
32106,
321... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0... | [
3,
23143,
14196,
3,
15438,
25424,
6227,
21341,
834,
89,
4350,
21680,
1236,
6157,
332,
536,
3,
15355,
3162,
17990,
6157,
332,
357,
9191,
332,
5411,
7,
17,
76,
834,
5525,
3274,
332,
4416,
7,
17,
76,
834,
5525,
549,
17444,
427,
17990,
... |
What is the name of department where has the smallest number of professors? | SELECT T2.dept_name FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY COUNT(*) LIMIT 1 | CREATE TABLE professor (dept_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
5812,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4350,
584,
4280,
28027,
6,
20,
102,
17,
834,
4978,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
26,
6707,
834,
4350,
21680,
5812,
6157,
332,
536,
3,
15355,
3162,
3066,
6157,
332,
357,
9191,
332,
5411,
26,
6707,
834,
4978,
3274,
332,
4416,
26,
6707,
834,
4978,
350,
4630,
6880,
272,
476,
332,
5411,
26... |
What is the name of department where has the largest number of professors with a Ph.D. degree? | SELECT T2.dept_name, T1.dept_code FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.prof_high_degree = 'Ph.D.' GROUP BY T1.dept_code ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE professor (dept_code VARCHAR, prof_high_degree VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
5812,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
6,
7108,
834,
6739,
834,
19706,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
435... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
26,
6707,
834,
4350,
6,
332,
5411,
26,
6707,
834,
4978,
21680,
5812,
6157,
332,
536,
3,
15355,
3162,
3066,
6157,
332,
357,
9191,
332,
5411,
26,
6707,
834,
4978,
3274,
332,
4416,
26,
6707,
834,
4978,
549,
... |
What are the first names of the professors who do not teach a class. | SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' EXCEPT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num | CREATE TABLE employee (emp_fname VARCHAR, emp_jobcode VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3490,
41,
15,
1167,
834,
89,
4350,
584,
4280,
28027,
6,
8943,
834,
16899,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
1409,
89,
834,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
8943,
834,
89,
4350,
21680,
3490,
549,
17444,
427,
8943,
834,
16899,
4978,
3274,
3,
31,
17618,
371,
31,
262,
4,
30416,
3,
23143,
14196,
332,
5411,
15,
1167,
834,
89,
4350,
21680,
3490,
6157,
332,
536,
3,
15355,
3162... |
What is the first names of the professors from the history department who do not teach a class. | SELECT T1.emp_fname FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History' EXCEPT SELECT T4.emp_fname FROM employee AS T4 JOIN CLASS AS T5 ON T4.emp_num = T5.prof_num | CREATE TABLE professor (emp_num VARCHAR, dept_code VARCHAR); CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
5812,
41,
15,
1167,
834,
5525,
584,
4280,
28027,
6,
20,
102,
17,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4978,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5411,
15,
1167,
834,
89,
4350,
21680,
3490,
6157,
332,
536,
3,
15355,
3162,
5812,
6157,
332,
357,
9191,
332,
5411,
15,
1167,
834,
5525,
3274,
332,
4416,
15,
1167,
834,
5525,
3,
15355,
3162,
3066,
6157,
332,
519... |
What is the last name and office of the professor from the history department? | SELECT T1.emp_lname, T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History' | CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE employee (emp_lname VARCHAR, emp_num VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
6,
20,
102,
17,
834,
4350,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3490,
41,
15,
1167,
834,
40,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5411,
15,
1167,
834,
40,
4350,
6,
332,
4416,
1409,
89,
834,
19632,
21680,
3490,
6157,
332,
536,
3,
15355,
3162,
5812,
6157,
332,
357,
9191,
332,
5411,
15,
1167,
834,
5525,
3274,
332,
4416,
15,
1167,
834,
5525,
... |
What is department name and office for the professor whose last name is Heffington? | SELECT T3.dept_name, T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T1.emp_lname = 'Heffington' | CREATE TABLE employee (emp_num VARCHAR, emp_lname VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3490,
41,
15,
1167,
834,
5525,
584,
4280,
28027,
6,
8943,
834,
40,
4350,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4350,
584,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5787,
26,
6707,
834,
4350,
6,
332,
4416,
1409,
89,
834,
19632,
21680,
3490,
6157,
332,
536,
3,
15355,
3162,
5812,
6157,
332,
357,
9191,
332,
5411,
15,
1167,
834,
5525,
3274,
332,
4416,
15,
1167,
834,
5525,
3,
... |
Find the last name and hire date of the professor who is in office DRE 102. | SELECT T1.emp_lname, T1.emp_hiredate FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num WHERE T2.prof_office = 'DRE 102' | CREATE TABLE professor (emp_num VARCHAR, prof_office VARCHAR); CREATE TABLE employee (emp_lname VARCHAR, emp_hiredate VARCHAR, emp_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
5812,
41,
15,
1167,
834,
5525,
584,
4280,
28027,
6,
7108,
834,
19632,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3490,
41,
15,
1167,
834,
40,
4350,
584,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5411,
15,
1167,
834,
40,
4350,
6,
332,
5411,
15,
1167,
834,
9288,
15,
5522,
21680,
3490,
6157,
332,
536,
3,
15355,
3162,
5812,
6157,
332,
357,
9191,
332,
5411,
15,
1167,
834,
5525,
3274,
332,
4416,
15,
1167,
... |
What is the code of the course which the student whose last name is Smithson took? | SELECT T1.crs_code FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num WHERE T3.stu_lname = 'Smithson' | CREATE TABLE student (stu_num VARCHAR, stu_lname VARCHAR); CREATE TABLE enroll (class_code VARCHAR, stu_num VARCHAR); CREATE TABLE CLASS (crs_code VARCHAR, class_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1236,
41,
7,
17,
76,
834,
5525,
584,
4280,
28027,
6,
21341,
834,
40,
4350,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
17990,
41,
4057,
834,
4978,
584,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5411,
75,
52,
7,
834,
4978,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
17990,
6157,
332,
357,
9191,
332,
5411,
4057,
834,
4978,
3274,
332,
4416,
4057,
834,
4978,
3,
15355,
3162,
1236,
6157,
332,
519,
9191... |
What are the description and credit of the course which the student whose last name is Smithson took? | SELECT T4.crs_description, T4.crs_credit FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num JOIN course AS T4 ON T4.crs_code = T1.crs_code WHERE T3.stu_lname = 'Smithson' | CREATE TABLE student (stu_num VARCHAR, stu_lname VARCHAR); CREATE TABLE course (crs_description VARCHAR, crs_credit VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE enroll (class_code VARCHAR, stu_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1236,
41,
7,
17,
76,
834,
5525,
584,
4280,
28027,
6,
21341,
834,
40,
4350,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
503,
41,
75,
52,
7,
834,
221,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
7984,
75,
52,
7,
834,
221,
11830,
6,
332,
7984,
75,
52,
7,
834,
15547,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
17990,
6157,
332,
357,
9191,
332,
5411,
4057,
834,
4978,
3274,
332,
4416,
4057,
834,
497... |
How many professors who has a either Ph.D. or MA degree? | SELECT COUNT(*) FROM professor WHERE prof_high_degree = 'Ph.D.' OR prof_high_degree = 'MA' | CREATE TABLE professor (prof_high_degree VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
5812,
41,
1409,
89,
834,
6739,
834,
19706,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
571,
186,
5812,
7,
113,
65,
3,
9,
893,
3657,
5,
308,
5,
42,
4800,
1952,
58,
1,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
61,
21680,
5812,
549,
17444,
427,
7108,
834,
6739,
834,
19706,
3274,
3,
31,
345,
107,
5,
308,
5,
31,
4674,
7108,
834,
6739,
834,
19706,
3274,
3,
31,
4148,
31,
1,
-100,
-100,
-100,
-100,
-10... |
How many professors who are from either Accounting or Biology department? | SELECT COUNT(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T2.dept_name = 'Accounting' OR T2.dept_name = 'Biology' | CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE professor (dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
6,
20,
102,
17,
834,
4350,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
5812,
41,
26,
6707,
834,
4978,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
61,
21680,
5812,
6157,
332,
536,
3,
15355,
3162,
3066,
6157,
332,
357,
9191,
332,
5411,
26,
6707,
834,
4978,
3274,
332,
4416,
26,
6707,
834,
4978,
549,
17444,
427,
332,
4416,
26,
6707,
834,
4... |
Find the first name of the professor who is teaching two courses with code CIS-220 and QM-261. | SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'CIS-220' INTERSECT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'QM-261' | CREATE TABLE CLASS (prof_num VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
1409,
89,
834,
5525,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3490,
41,
15,
1167,
834,
89,
4350,
584,
4280,
28027,
6,
8943,
834,
5525,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5411,
15,
1167,
834,
89,
4350,
21680,
3490,
6157,
332,
536,
3,
15355,
3162,
3,
31598,
6157,
332,
357,
9191,
332,
5411,
15,
1167,
834,
5525,
3274,
332,
4416,
1409,
89,
834,
5525,
549,
17444,
427,
5764,
7,
834,
... |
What is the average gpa of the students enrolled in the course with code ACCT-211? | SELECT AVG(T2.stu_gpa) FROM enroll AS T1 JOIN student AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T1.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211' | CREATE TABLE enroll (stu_num VARCHAR, class_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE student (stu_gpa INTEGER, stu_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
17990,
41,
7,
17,
76,
834,
5525,
584,
4280,
28027,
6,
853,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
4057,
834,
4978,
584,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
71,
17217,
599,
382,
4416,
7,
17,
76,
834,
122,
102,
9,
61,
21680,
17990,
6157,
332,
536,
3,
15355,
3162,
1236,
6157,
332,
357,
9191,
332,
5411,
7,
17,
76,
834,
5525,
3274,
332,
4416,
7,
17,
76,
834,
5525,
3,
... |
What is the first name, gpa and phone number of the top 5 students with highest gpa? | SELECT stu_gpa, stu_phone, stu_fname FROM student ORDER BY stu_gpa DESC LIMIT 5 | CREATE TABLE student (stu_gpa VARCHAR, stu_phone VARCHAR, stu_fname VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1236,
41,
7,
17,
76,
834,
122,
102,
9,
584,
4280,
28027,
6,
21341,
834,
6399,
584,
4280,
28027,
6,
21341,
834,
89,
4350,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
363,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
21341,
834,
122,
102,
9,
6,
21341,
834,
6399,
6,
21341,
834,
89,
4350,
21680,
1236,
4674,
11300,
272,
476,
21341,
834,
122,
102,
9,
309,
25067,
8729,
12604,
305,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
What is the department name of the students with lowest gpa belongs to? | 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 | CREATE TABLE student (dept_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1236,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4350,
584,
4280,
28027,
6,
20,
102,
17,
834,
4978,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
26,
6707,
834,
4350,
21680,
1236,
6157,
332,
536,
3,
15355,
3162,
3066,
6157,
332,
357,
9191,
332,
5411,
26,
6707,
834,
4978,
3274,
332,
4416,
26,
6707,
834,
4978,
4674,
11300,
272,
476,
21341,
834,
122,
... |
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) | CREATE TABLE student (stu_fname VARCHAR, stu_gpa INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1236,
41,
7,
17,
76,
834,
89,
4350,
584,
4280,
28027,
6,
21341,
834,
122,
102,
9,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
2588,
8,
166,
564,
11,
3,
122,
102,
9,
13,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
21341,
834,
89,
4350,
6,
21341,
834,
122,
102,
9,
21680,
1236,
549,
17444,
427,
21341,
834,
122,
102,
9,
3,
2,
41,
23143,
14196,
71,
17217,
599,
7,
17,
76,
834,
122,
102,
9,
61,
21680,
1236,
61,
1,
-100,
-100,
... |
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 | CREATE TABLE student (dept_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_address VARCHAR, dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1236,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4350,
584,
4280,
28027,
6,
20,
102,
17,
834,
9,
26,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
26,
6707,
834,
4350,
6,
332,
4416,
26,
6707,
834,
9,
26,
12039,
21680,
1236,
6157,
332,
536,
3,
15355,
3162,
3066,
6157,
332,
357,
9191,
332,
5411,
26,
6707,
834,
4978,
3274,
332,
4416,
26,
6707,
834,
4... |
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 | CREATE TABLE student (dept_code VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_address VARCHAR, dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1236,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4350,
584,
4280,
28027,
6,
20,
102,
17,
834,
9,
26,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
26,
6707,
834,
4350,
6,
332,
4416,
26,
6707,
834,
9,
26,
12039,
6,
2847,
17161,
599,
1935,
61,
21680,
1236,
6157,
332,
536,
3,
15355,
3162,
3066,
6157,
332,
357,
9191,
332,
5411,
26,
6707,
834,
4978,
32... |
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.' | CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR, prof_high_degree VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
6,
20,
102,
17,
834,
4350,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
5812,
41,
1409,
89,
834,
19632,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5411,
15,
1167,
834,
89,
4350,
6,
332,
4416,
1409,
89,
834,
19632,
21680,
3490,
6157,
332,
536,
3,
15355,
3162,
5812,
6157,
332,
357,
9191,
332,
5411,
15,
1167,
834,
5525,
3274,
332,
4416,
15,
1167,
834,
5525,
... |
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 | CREATE TABLE CLASS (crs_code VARCHAR, prof_num VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
75,
52,
7,
834,
4978,
584,
4280,
28027,
6,
7108,
834,
5525,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3490,
41,
15,
1167,
834,
89,
4350... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
15,
1167,
834,
89,
4350,
6,
332,
5411,
75,
52,
7,
834,
4978,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
3490,
6157,
332,
357,
9191,
332,
5411,
1409,
89,
834,
5525,
3274,
332,
4416,
15,
1167,
834,
... |
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 | CREATE TABLE course (crs_description VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR, crs_code VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
503,
41,
75,
52,
7,
834,
221,
11830,
584,
4280,
28027,
6,
5764,
7,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
1409,
89,
834,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
15,
1167,
834,
89,
4350,
6,
332,
5787,
75,
52,
7,
834,
221,
11830,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
3490,
6157,
332,
357,
9191,
332,
5411,
1409,
89,
834,
5525,
3274,
332,
4416,
15,
1167,... |
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 | CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR); CREATE TABLE course (crs_description VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR, crs_code VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
5812,
41,
1409,
89,
834,
19632,
584,
4280,
28027,
6,
8943,
834,
5525,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
503,
41,
75,
52,
7,
834,
221,
11830,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
15,
1167,
834,
89,
4350,
6,
332,
7984,
1409,
89,
834,
19632,
6,
332,
5787,
75,
52,
7,
834,
221,
11830,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
3490,
6157,
332,
357,
9191,
332,
5411,
1409,
89,
... |
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 | CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR); CREATE TABLE course (crs_description VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR, crs_code VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3490,
41,
15,
1167,
834,
89,
4350,
584,
4280,
28027,
6,
8943,
834,
5525,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4350,
584,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
15,
1167,
834,
89,
4350,
6,
332,
7984,
1409,
89,
834,
19632,
6,
332,
5787,
75,
52,
7,
834,
221,
11830,
6,
332,
9125,
26,
6707,
834,
4350,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
3490,
6157,
3... |
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 | CREATE TABLE enroll (stu_num VARCHAR, class_code VARCHAR); CREATE TABLE course (crs_description VARCHAR, crs_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_lname VARCHAR, stu_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
17990,
41,
7,
17,
76,
834,
5525,
584,
4280,
28027,
6,
853,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
503,
41,
75,
52,
7,
834,
221,
11830,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5411,
7,
17,
76,
834,
89,
4350,
6,
332,
5411,
7,
17,
76,
834,
40,
4350,
6,
332,
7984,
75,
52,
7,
834,
221,
11830,
21680,
1236,
6157,
332,
536,
3,
15355,
3162,
17990,
6157,
332,
357,
9191,
332,
5411,
7,
17... |
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' | CREATE TABLE enroll (stu_num VARCHAR, enroll_grade VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_lname VARCHAR, stu_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
17990,
41,
7,
17,
76,
834,
5525,
584,
4280,
28027,
6,
17990,
834,
6801,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
1236,
41,
7,
17,
76,
834,
89,
4350,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5411,
7,
17,
76,
834,
89,
4350,
6,
332,
5411,
7,
17,
76,
834,
40,
4350,
21680,
1236,
6157,
332,
536,
3,
15355,
3162,
17990,
6157,
332,
357,
9191,
332,
5411,
7,
17,
76,
834,
5525,
3274,
332,
4416,
7,
17,
7... |
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' | CREATE TABLE CLASS (class_room VARCHAR, prof_num VARCHAR); CREATE TABLE professor (emp_num VARCHAR, dept_code VARCHAR); CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
4057,
834,
3082,
584,
4280,
28027,
6,
7108,
834,
5525,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
5812,
41,
15,
1167,
834,
5525,
584,
4280... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
15,
1167,
834,
89,
4350,
6,
332,
5411,
4057,
834,
3082,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
3490,
6157,
332,
357,
9191,
332,
5411,
1409,
89,
834,
5525,
3274,
332,
4416,
15,
1167,
834,
5525,
... |
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' | CREATE TABLE professor (prof_high_degree VARCHAR, emp_num VARCHAR, dept_code VARCHAR); CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
5812,
41,
1409,
89,
834,
6739,
834,
19706,
584,
4280,
28027,
6,
8943,
834,
5525,
584,
4280,
28027,
6,
20,
102,
17,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
3,
15438,
25424,
6227,
332,
4416,
15,
1167,
834,
89,
4350,
6,
332,
5787,
1409,
89,
834,
6739,
834,
19706,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
3490,
6157,
332,
357,
9191,
332,
5411,
1409,
89,
834,
5525,
... |
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 | CREATE TABLE enroll (stu_num VARCHAR, enroll_grade VARCHAR, class_code VARCHAR); CREATE TABLE student (stu_lname VARCHAR, stu_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
17990,
41,
7,
17,
76,
834,
5525,
584,
4280,
28027,
6,
17990,
834,
6801,
584,
4280,
28027,
6,
853,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5411,
7,
17,
76,
834,
40,
4350,
21680,
1236,
6157,
332,
536,
3,
15355,
3162,
17990,
6157,
332,
357,
9191,
332,
5411,
7,
17,
76,
834,
5525,
3274,
332,
4416,
7,
17,
76,
834,
5525,
549,
17444,
427,
332,
4416,
... |
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.' | CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR); CREATE TABLE professor (prof_office VARCHAR, emp_num VARCHAR, dept_code VARCHAR, prof_high_degree VARCHAR); CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
6,
20,
102,
17,
834,
4350,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
5812,
41,
1409,
89,
834,
19632,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
15,
1167,
834,
89,
4350,
6,
332,
5411,
1409,
89,
834,
19632,
21680,
5812,
6157,
332,
536,
3,
15355,
3162,
3490,
6157,
332,
357,
9191,
332,
5411,
15,
1167,
834,
5525,
3274,
332,
4416,
15,
1167,
834,
5525,
... |
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 | CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR); CREATE TABLE CLASS (prof_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
3490,
41,
15,
1167,
834,
89,
4350,
584,
4280,
28027,
6,
8943,
834,
5525,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
1409,
89,
834,
5525,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
15,
1167,
834,
89,
4350,
21680,
3,
31598,
6157,
332,
536,
3,
15355,
3162,
3490,
6157,
332,
357,
9191,
332,
5411,
1409,
89,
834,
5525,
3274,
332,
4416,
15,
1167,
834,
5525,
350,
4630,
6880,
272,
476,
332,
... |
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 | CREATE TABLE enroll (stu_num VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_num VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
17990,
41,
7,
17,
76,
834,
5525,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
1236,
41,
7,
17,
76,
834,
89,
4350,
584,
4280,
28027,
6,
21341,
834,
5525,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5411,
7,
17,
76,
834,
89,
4350,
21680,
1236,
6157,
332,
536,
3,
15355,
3162,
17990,
6157,
332,
357,
9191,
332,
5411,
7,
17,
76,
834,
5525,
3274,
332,
4416,
7,
17,
76,
834,
5525,
350,
4630,
6880,
272,
476,
3... |
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%' | CREATE TABLE course (dept_code VARCHAR, crs_description VARCHAR); CREATE TABLE department (dept_name VARCHAR, dept_code VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
503,
41,
26,
6707,
834,
4978,
584,
4280,
28027,
6,
5764,
7,
834,
221,
11830,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3066,
41,
26,
6707,
834,
4350,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
4416,
26,
6707,
834,
4350,
21680,
503,
6157,
332,
536,
3,
15355,
3162,
3066,
6157,
332,
357,
9191,
332,
5411,
26,
6707,
834,
4978,
3274,
332,
4416,
26,
6707,
834,
4978,
549,
17444,
427,
332,
5411,
75,
52,
7,
... |
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%' | CREATE TABLE enroll (stu_num VARCHAR, class_code VARCHAR); CREATE TABLE CLASS (class_code VARCHAR, crs_code VARCHAR); CREATE TABLE student (stu_fname VARCHAR, stu_num VARCHAR, stu_lname VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
17990,
41,
7,
17,
76,
834,
5525,
584,
4280,
28027,
6,
853,
834,
4978,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
3,
31598,
41,
4057,
834,
4978,
584,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5411,
7,
17,
76,
834,
89,
4350,
21680,
1236,
6157,
332,
536,
3,
15355,
3162,
17990,
6157,
332,
357,
9191,
332,
5411,
7,
17,
76,
834,
5525,
3274,
332,
4416,
7,
17,
76,
834,
5525,
3,
15355,
3162,
3,
31598,
61... |
How many clubs are there? | SELECT COUNT(*) FROM club | CREATE TABLE club (Id VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1886,
41,
196,
26,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
571,
186,
8122,
33,
132,
58,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
61,
21680,
1886,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
List the distinct region of clubs in ascending alphabetical order. | SELECT DISTINCT Region FROM club ORDER BY Region | CREATE TABLE club (Region VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1886,
41,
17748,
23,
106,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
6792,
8,
6746,
1719,
13,
8122,
16,
25200,
53,
20688,
1950,
455,
5,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
3,
15438,
25424,
6227,
6163,
21680,
1886,
4674,
11300,
272,
476,
6163,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
What is the average number of gold medals for clubs? | SELECT AVG(Gold) FROM club_rank | CREATE TABLE club_rank (Gold INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1886,
834,
6254,
41,
23576,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
363,
19,
8,
1348,
381,
13,
2045,
9365,
7,
21,
8122,
58,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
71,
17217,
599,
23576,
61,
21680,
1886,
834,
6254,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
What are the types and countries of competitions? | SELECT Competition_type, Country FROM competition | CREATE TABLE competition (Competition_type VARCHAR, Country VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
2259,
41,
5890,
4995,
4749,
834,
6137,
584,
4280,
28027,
6,
6993,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
363,
33,
8,
1308,
11,
1440,
13,
2259,
7,
58,
1,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
15571,
834,
6137,
6,
6993,
21680,
2259,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
What are the distinct years in which the competitions type is not "Tournament"? | SELECT DISTINCT YEAR FROM competition WHERE Competition_type <> "Tournament" | CREATE TABLE competition (YEAR VARCHAR, Competition_type VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
2259,
41,
476,
19356,
584,
4280,
28027,
6,
15571,
834,
6137,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
363,
33,
8,
6746,
203,
16,
84,
8,
2259,
7,
686,
19,
59,
96,
382,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
3,
15438,
25424,
6227,
30431,
21680,
2259,
549,
17444,
427,
15571,
834,
6137,
3,
2,
3155,
96,
382,
1211,
20205,
17,
121,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
What are the maximum and minimum number of silver medals for clubs. | SELECT MAX(Silver), MIN(Silver) FROM club_rank | CREATE TABLE club_rank (Silver INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1886,
834,
6254,
41,
134,
173,
624,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
363,
33,
8,
2411,
11,
2559,
381,
13,
4294,
9365,
7,
21,
8122,
5,
1,
0,
0,
0,
0,
0,
0,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
4800,
4,
599,
134,
173,
624,
201,
3,
17684,
599,
134,
173,
624,
61,
21680,
1886,
834,
6254,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
How many clubs have total medals less than 10? | SELECT COUNT(*) FROM club_rank WHERE Total < 10 | CREATE TABLE club_rank (Total INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1886,
834,
6254,
41,
3696,
1947,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
571,
186,
8122,
43,
792,
9365,
7,
705,
145,
335,
58,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
61,
21680,
1886,
834,
6254,
549,
17444,
427,
9273,
3,
2,
335,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
List all club names in ascending order of start year. | SELECT name FROM club ORDER BY Start_year | CREATE TABLE club (name VARCHAR, Start_year VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1886,
41,
4350,
584,
4280,
28027,
6,
3273,
834,
1201,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
6792,
66,
1886,
3056,
16,
25200,
53,
455,
13,
456,
215,
5,
1,
0,
0,
0,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
564,
21680,
1886,
4674,
11300,
272,
476,
3273,
834,
1201,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
List all club names in descending alphabetical order. | SELECT name FROM club ORDER BY name DESC | CREATE TABLE club (name VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1886,
41,
4350,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
6792,
66,
1886,
3056,
16,
3,
30960,
20688,
1950,
455,
5,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
564,
21680,
1886,
4674,
11300,
272,
476,
564,
309,
25067,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
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 | CREATE TABLE club (name VARCHAR, Club_ID VARCHAR); CREATE TABLE player (Player_id VARCHAR, Club_ID VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1886,
41,
4350,
584,
4280,
28027,
6,
1949,
834,
4309,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
1959,
41,
15800,
49,
834,
23,
26,
584,
4280,
28027,
6,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5411,
4350,
6,
332,
4416,
15800,
49,
834,
23,
26,
21680,
1886,
6157,
332,
536,
3,
15355,
3162,
1959,
6157,
332,
357,
9191,
332,
5411,
254,
11158,
834,
4309,
3274,
332,
4416,
254,
11158,
834,
4309,
1,
-100,
-100... |
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" | CREATE TABLE club (name VARCHAR, Club_ID VARCHAR); CREATE TABLE player (Club_ID VARCHAR, Position VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1886,
41,
4350,
584,
4280,
28027,
6,
1949,
834,
4309,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
1959,
41,
254,
11158,
834,
4309,
584,
4280,
28027,
6,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
332,
5411,
4350,
21680,
1886,
6157,
332,
536,
3,
15355,
3162,
1959,
6157,
332,
357,
9191,
332,
5411,
254,
11158,
834,
4309,
3274,
332,
4416,
254,
11158,
834,
4309,
549,
17444,
427,
332,
4416,
345,
32,
7,
4749,
3274,
... |
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" | CREATE TABLE player (Points INTEGER, Club_ID VARCHAR); CREATE TABLE club (Club_ID VARCHAR, name VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1959,
41,
22512,
7,
3,
21342,
17966,
6,
1949,
834,
4309,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
1886,
41,
254,
11158,
834,
4309,
584,
4280,
28027,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
71,
17217,
599,
382,
4416,
22512,
7,
61,
21680,
1886,
6157,
332,
536,
3,
15355,
3162,
1959,
6157,
332,
357,
9191,
332,
5411,
254,
11158,
834,
4309,
3274,
332,
4416,
254,
11158,
834,
4309,
549,
17444,
427,
332,
5411,
... |
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 | CREATE TABLE player (POSITION VARCHAR, Points INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1959,
41,
16034,
196,
9562,
584,
4280,
28027,
6,
4564,
7,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
6792,
8,
1102,
13,
1508,
11,
8,
1348,
381,
13,
979,
13,
1508,
13,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
3,
16034,
196,
9562,
6,
71,
17217,
599,
22512,
7,
61,
21680,
1959,
350,
4630,
6880,
272,
476,
3,
16034,
196,
9562,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
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 | CREATE TABLE player (POSITION VARCHAR, name VARCHAR, Points INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1959,
41,
16034,
196,
9562,
584,
4280,
28027,
6,
564,
584,
4280,
28027,
6,
4564,
7,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
6792,
8,
1102,
13,
1508,
28,
1348,
381,
13,
97... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
3,
16034,
196,
9562,
21680,
1959,
350,
4630,
6880,
272,
476,
564,
454,
6968,
2365,
71,
17217,
599,
22512,
7,
61,
2490,
2423,
460,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
List the types of competition and the number of competitions of each type. | SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type | CREATE TABLE competition (Competition_type VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
2259,
41,
5890,
4995,
4749,
834,
6137,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
6792,
8,
1308,
13,
2259,
11,
8,
381,
13,
2259,
7,
13,
284,
686,
5,
1,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
15571,
834,
6137,
6,
2847,
17161,
599,
1935,
61,
21680,
2259,
350,
4630,
6880,
272,
476,
15571,
834,
6137,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
List the most common type of competition. | SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE competition (Competition_type VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
2259,
41,
5890,
4995,
4749,
834,
6137,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
6792,
8,
167,
1017,
686,
13,
2259,
5,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
15571,
834,
6137,
21680,
2259,
350,
4630,
6880,
272,
476,
15571,
834,
6137,
4674,
11300,
272,
476,
2847,
17161,
599,
1935,
61,
309,
25067,
8729,
12604,
209,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,... |
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 | CREATE TABLE competition (Competition_type VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
2259,
41,
5890,
4995,
4749,
834,
6137,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
6792,
8,
1308,
13,
2259,
24,
43,
44,
167,
874,
2259,
7,
13,
24,
686,
5,
1,
0,
0,
0,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
15571,
834,
6137,
21680,
2259,
350,
4630,
6880,
272,
476,
15571,
834,
6137,
454,
6968,
2365,
2847,
17161,
599,
1935,
61,
3,
2,
2423,
305,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
List the names of clubs that do not have any players. | SELECT name FROM CLub WHERE NOT Club_ID IN (SELECT Club_ID FROM player) | CREATE TABLE player (name VARCHAR, Club_ID VARCHAR); CREATE TABLE CLub (name VARCHAR, Club_ID VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1959,
41,
4350,
584,
4280,
28027,
6,
1949,
834,
4309,
584,
4280,
28027,
61,
3,
32105,
32106,
32102,
205,
4386,
6048,
332,
17098,
11175,
76,
115,
41,
4350,
584,
4280,
28027,
6,
1949,
83... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
564,
21680,
11175,
76,
115,
549,
17444,
427,
4486,
1949,
834,
4309,
3388,
41,
23143,
14196,
1949,
834,
4309,
21680,
1959,
61,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
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 | CREATE TABLE player (POSITION VARCHAR, Points INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1959,
41,
16034,
196,
9562,
584,
4280,
28027,
6,
4564,
7,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
363,
33,
8,
4655,
28,
321,
1508,
578,
72,
145,
460,
979,
11,
705,
145,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
3,
16034,
196,
9562,
21680,
1959,
549,
17444,
427,
4564,
7,
2490,
460,
3,
21342,
5249,
14196,
3,
23143,
14196,
3,
16034,
196,
9562,
21680,
1959,
549,
17444,
427,
4564,
7,
3,
2,
335,
1,
-100,
-100,
-100,
-100,
-100,
... |
Show total points of all players. | SELECT SUM(Points) FROM player | CREATE TABLE player (Points INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1959,
41,
22512,
7,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
3111,
792,
979,
13,
66,
1508,
5,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
180,
6122,
599,
22512,
7,
61,
21680,
1959,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,... |
how many different positions are there? | SELECT COUNT(DISTINCT POSITION) FROM player | CREATE TABLE player (POSITION VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1959,
41,
16034,
196,
9562,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
149,
186,
315,
4655,
33,
132,
58,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
15438,
25424,
6227,
3,
16034,
196,
9562,
61,
21680,
1959,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
what are the name of players who get more than the average points. | SELECT name FROM player WHERE points > (SELECT AVG(points) FROM player) | CREATE TABLE player (name VARCHAR, points INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1959,
41,
4350,
584,
4280,
28027,
6,
979,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
125,
33,
8,
564,
13,
1508,
113,
129,
72,
145,
8,
1348,
979,
5,
1,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
564,
21680,
1959,
549,
17444,
427,
979,
2490,
41,
23143,
14196,
71,
17217,
599,
2700,
7,
61,
21680,
1959,
61,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
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 | CREATE TABLE player (POSITION VARCHAR, points INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1959,
41,
16034,
196,
9562,
584,
4280,
28027,
6,
979,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
253,
8,
381,
13,
1508,
3,
2544,
979,
33,
1364,
145,
604,
16,
284,
1102,
5,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
2847,
17161,
599,
1935,
201,
3,
16034,
196,
9562,
21680,
1959,
549,
17444,
427,
979,
3,
2,
604,
350,
4630,
6880,
272,
476,
3,
16034,
196,
9562,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-1... |
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 | CREATE TABLE competition (country VARCHAR, competition_type VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
2259,
41,
17529,
584,
4280,
28027,
6,
2259,
834,
6137,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
84,
684,
410,
10627,
16,
8,
167,
381,
13,
20502,
2259,
7,
58,
1,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
684,
21680,
2259,
549,
17444,
427,
2259,
834,
6137,
3274,
3,
31,
382,
1211,
20205,
17,
31,
350,
4630,
6880,
272,
476,
684,
4674,
11300,
272,
476,
2847,
17161,
599,
1935,
61,
309,
25067,
8729,
12604,
209,
1,
-100,
-1... |
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' | CREATE TABLE competition (country VARCHAR, competition_type VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
2259,
41,
17529,
584,
4280,
28027,
6,
2259,
834,
6137,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
84,
1440,
410,
10627,
16,
321,
27105,
11,
20502,
686,
2259,
7,
5,
1,
0,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
684,
21680,
2259,
549,
17444,
427,
2259,
834,
6137,
3274,
3,
31,
17701,
120,
31,
3,
21342,
5249,
14196,
3,
23143,
14196,
684,
21680,
2259,
549,
17444,
427,
2259,
834,
6137,
3274,
3,
31,
382,
1211,
20205,
17,
31,
1,
... |
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' | CREATE TABLE competition (country VARCHAR, competition_type VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
2259,
41,
17529,
584,
4280,
28027,
6,
2259,
834,
6137,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
2588,
8,
1440,
24,
43,
470,
10627,
16,
136,
2259,
28,
27105,
686,
5,
1,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
684,
21680,
2259,
262,
4,
30416,
3,
23143,
14196,
684,
21680,
2259,
549,
17444,
427,
2259,
834,
6137,
3274,
3,
31,
17701,
120,
31,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,... |
How many furniture components are there in total? | SELECT SUM(num_of_component) FROM furniture | CREATE TABLE furniture (num_of_component INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1991,
41,
5525,
834,
858,
834,
287,
9977,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
571,
186,
1991,
3379,
33,
132,
16,
792,
58,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
180,
6122,
599,
5525,
834,
858,
834,
287,
9977,
61,
21680,
1991,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
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 | CREATE TABLE furniture (name VARCHAR, furniture_id VARCHAR, market_rate VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1991,
41,
4350,
584,
4280,
28027,
6,
1991,
834,
23,
26,
584,
4280,
28027,
6,
512,
834,
2206,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
9778,
8,
564,
11,
3,
23,
26,
13,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
564,
6,
1991,
834,
23,
26,
21680,
1991,
4674,
11300,
272,
476,
512,
834,
2206,
309,
25067,
8729,
12604,
209,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
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 | CREATE TABLE furniture (market_rate INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1991,
41,
8809,
834,
2206,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
253,
8,
792,
512,
1080,
13,
8,
1991,
7,
24,
43,
8,
420,
204,
512,
4776,
5,
1,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
180,
6122,
599,
8809,
834,
2206,
61,
21680,
1991,
4674,
11300,
272,
476,
512,
834,
2206,
309,
25067,
8729,
12604,
204,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
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 | CREATE TABLE furniture (Num_of_Component INTEGER, name VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1991,
41,
567,
440,
834,
858,
834,
5890,
9977,
3,
21342,
17966,
6,
564,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
2588,
8,
3876,
6201,
11,
3056,
13,
66,
1991,
7,
24,
43,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
1174,
51,
834,
858,
834,
5890,
9977,
6,
564,
21680,
1991,
549,
17444,
427,
1174,
51,
834,
858,
834,
5890,
9977,
2490,
335,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
Find the name and component amount of the least popular furniture. | SELECT name, Num_of_Component FROM furniture ORDER BY market_rate LIMIT 1 | CREATE TABLE furniture (name VARCHAR, Num_of_Component VARCHAR, market_rate VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1991,
41,
4350,
584,
4280,
28027,
6,
1174,
51,
834,
858,
834,
5890,
9977,
584,
4280,
28027,
6,
512,
834,
2206,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
2588,
8,
564,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
564,
6,
1174,
51,
834,
858,
834,
5890,
9977,
21680,
1991,
4674,
11300,
272,
476,
512,
834,
2206,
8729,
12604,
209,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
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) | CREATE TABLE furniture_manufacte (Furniture_ID VARCHAR, Price_in_Dollar INTEGER); CREATE TABLE furniture (name VARCHAR, Furniture_ID VARCHAR); CREATE TABLE furniture_manufacte (Price_in_Dollar INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
1991,
834,
348,
76,
8717,
15,
41,
371,
450,
29,
23,
2693,
834,
4309,
584,
4280,
28027,
6,
5312,
834,
77,
834,
4135,
195,
291,
3,
21342,
17966,
61,
3,
32105,
32106,
32102,
205,
4386,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
3,
23143,
14196,
3,
17,
5411,
4350,
21680,
1991,
6157,
3,
17,
536,
3,
15355,
3162,
1991,
834,
348,
76,
8717,
15,
6157,
3,
17,
357,
9191,
3,
17,
5411,
371,
450,
29,
23,
2693,
834,
4309,
3274,
3,
17,
4416,
371,
450,
29,
23,
2693... |
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 | CREATE TABLE manufacturer (open_year VARCHAR, name VARCHAR, num_of_shops VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
4818,
41,
8751,
834,
1201,
584,
4280,
28027,
6,
564,
584,
4280,
28027,
6,
3,
5525,
834,
858,
834,
6921,
7,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
4073,
4818,
65,
8,
167... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
539,
834,
1201,
6,
564,
21680,
4818,
4674,
11300,
272,
476,
3,
5525,
834,
858,
834,
6921,
7,
309,
25067,
8729,
12604,
209,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
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 | CREATE TABLE manufacturer (Num_of_Factories INTEGER, num_of_shops INTEGER) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
4818,
41,
567,
440,
834,
858,
834,
371,
9,
5317,
725,
3,
21342,
17966,
6,
3,
5525,
834,
858,
834,
6921,
7,
3,
21342,
17966,
61,
3,
32105,
32106,
32107,
32106,
2588,
8,
1348,
381,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
71,
17217,
599,
567,
440,
834,
858,
834,
371,
9,
5317,
725,
61,
21680,
4818,
549,
17444,
427,
3,
5525,
834,
858,
834,
6921,
7,
2490,
460,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
List all manufacturer names and ids ordered by their opening year. | SELECT name, manufacturer_id FROM manufacturer ORDER BY open_year | CREATE TABLE manufacturer (name VARCHAR, manufacturer_id VARCHAR, open_year VARCHAR) | [
32100,
32106,
32105,
205,
4386,
6048,
332,
17098,
4818,
41,
4350,
584,
4280,
28027,
6,
4818,
834,
23,
26,
584,
4280,
28027,
6,
539,
834,
1201,
584,
4280,
28027,
61,
3,
32105,
32106,
32107,
32106,
6792,
66,
4818,
3056,
11,
3,
23,
26,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
3,
23143,
14196,
564,
6,
4818,
834,
23,
26,
21680,
4818,
4674,
11300,
272,
476,
539,
834,
1201,
1,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.