db_id stringclasses 146
values | question stringlengths 3 224 | sql stringlengths 18 577 | database_schema stringclasses 146
values |
|---|---|---|---|
college_1 | What is the name of the department with the student that has the lowest GPA? | SELECT T2.dept_name FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code ORDER BY stu_gpa LIMIT 1 | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What is the first name and GPA of every student that has a GPA lower than average? | SELECT stu_fname , stu_gpa FROM student WHERE stu_gpa < (SELECT avg(stu_gpa) FROM student) | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What is the name and address of the department with the most students? | SELECT T2.dept_name , T2.dept_address FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What is the name, address, and number of students in the departments that have the 3 most students? | SELECT T2.dept_name , T2.dept_address , count(*) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 3 | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What are the first names and office of the professors who are in the history department and have a Ph.D? | SELECT T1.emp_fname , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T3.dept_code = T2.dept_code WHERE T3.dept_name = 'History' AND T2.prof_high_degree = 'Ph.D.' | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What are the first names of all teachers who have taught a course and the corresponding course codes? | SELECT T2.emp_fname , T1.crs_code FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What are the first names of all teachers who have taught a course and the corresponding descriptions? | SELECT T2.emp_fname , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What are the first names, office locations of all lecturers who have taught some course? | SELECT T2.emp_fname , T4.prof_office , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What are the first names, office locations, and departments of all instructors, and also what are the descriptions of the courses they teach? | SELECT T2.emp_fname , T4.prof_office , T3.crs_description , T5.dept_name FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num JOIN department AS T5 ON T4.dept_code = T5.dept_code | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What are the names of all students who took a class and the corresponding course descriptions? | SELECT T1.stu_fname , T1.stu_lname , T4.crs_description FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What are the names of all students taking a course who received an A or C? | SELECT T1.stu_fname , T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'C' OR T2.enroll_grade = 'A' | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What are the first names of all Accounting professors who teach and what are the classrooms of the courses they teach? | SELECT T2.emp_fname , T1.class_room FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Accounting' | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What are the different first names and highest degree attained for professors teaching in the Computer Information Systems department? | SELECT DISTINCT T2.emp_fname , T3.prof_high_degree FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Computer Info. Systems' | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What is the last name of the student who received an A in the class with the code 10018? | SELECT T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'A' AND T2.class_code = 10018 | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What are the first names and offices of history professors who don't have Ph.D.s? | SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T1.dept_code = T3.dept_code WHERE T3.dept_name = 'History' AND T1.prof_high_degree != 'Ph.D.' | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What are the first names of all professors who teach more than one class? | SELECT T2.emp_fname FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING count(*) > 1 | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What are the first names of student who only took one course? | SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num GROUP BY T2.stu_num HAVING count(*) = 1 | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What is the name of the department that offers a course that has a description including the word "Statistics"? | SELECT T2.dept_name FROM course AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.crs_description LIKE '%Statistics%' | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | 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 CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
college_1 | What is the first name of the student whose last name starts with the letter S and is taking ACCT-211? | SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211' AND T1.stu_lname LIKE 'S%' | CREATE TABLE CLASS (
CLASS_CODE varchar(5) PRIMARY KEY,
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int,
FOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)
FOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from CLASS table:
CLASS_CODE CRS_CODE CLASS_SECTION CLASS_TIME CLASS_ROOM PROF_NUM
10012 ACCT-211 1 MWF 8:00-8:50 a.m. BUS311 105
10013 ACCT-211 2 MWF 9:00-9:50 a.m. BUS200 105
10014 ACCT-211 3 TTh 2:30-3:45 p.m. BUS252 342
CREATE TABLE COURSE (
CRS_CODE varchar(10) PRIMARY KEY,
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from COURSE table:
CRS_CODE DEPT_CODE CRS_DESCRIPTION CRS_CREDIT
ACCT-211 ACCT Accounting I 3.0
ACCT-212 ACCT Accounting II 3.0
CIS-220 CIS Intro. to Microcomputing 3.0
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10) PRIMARY KEY,
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)
)
3 rows from DEPARTMENT table:
DEPT_CODE DEPT_NAME SCHOOL_CODE EMP_NUM DEPT_ADDRESS DEPT_EXTENSION
ACCT Accounting BUS 114 KLR 211, Box 52 3119
ART Fine Arts A&SCI 435 BBG 185, Box 128 2278
BIOL Biology A&SCI 387 AAK 230, Box 415 4117
CREATE TABLE EMPLOYEE (
EMP_NUM int PRIMARY KEY,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
3 rows from EMPLOYEE table:
EMP_NUM EMP_LNAME EMP_FNAME EMP_INITIAL EMP_JOBCODE EMP_HIREDATE EMP_DOB
100 Worley James F CUST 1978-2-23 1950-6-12
101 Ramso Henry B CUST 1994-11-15 1961-11-2
102 Edwards Rosemary D TECH 1990-7-23 1953-7-3
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50),
FOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)
FOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)
)
3 rows from ENROLL table:
CLASS_CODE STU_NUM ENROLL_GRADE
10014 321452 C
10014 324257 B
10018 321452 A
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5),
FOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from PROFESSOR table:
EMP_NUM DEPT_CODE PROF_OFFICE PROF_EXTENSION PROF_HIGH_DEGREE
103 HIST DRE 156 6783 Ph.D.
104 ENG DRE 102 5561 MA
105 ACCT KLR 229D 8665 Ph.D.
CREATE TABLE STUDENT (
STU_NUM int PRIMARY KEY,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int,
FOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)
)
3 rows from STUDENT table:
STU_NUM STU_LNAME STU_FNAME STU_INIT STU_DOB STU_HRS STU_CLASS STU_GPA STU_TRANSFER DEPT_CODE STU_PHONE PROF_NUM
321452 Bowser William C 1975-2-12 42 So 2.84 0 BIOL 2134 205
324257 Smithson Anne K 1981-11-15 81 Jr 3.27 1 CIS 2256 222
324258 Brewer Juliette 1969-8-23 36 So 2.26 1 ACCT 2256 228
|
sports_competition | How many clubs are there? | SELECT count(*) FROM club | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What is the total number of clubs? | SELECT count(*) FROM club | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | List the distinct region of clubs in ascending alphabetical order. | SELECT DISTINCT Region FROM club ORDER BY Region ASC | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the different regions of clubs in ascending alphabetical order? | SELECT DISTINCT Region FROM club ORDER BY Region ASC | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What is the average number of gold medals for clubs? | SELECT avg(Gold) FROM club_rank | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What is the average number of gold medals for a club? | SELECT avg(Gold) FROM club_rank | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the types and countries of competitions? | SELECT Competition_type , Country FROM competition | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the types of every competition and in which countries are they located? | SELECT Competition_type , Country FROM competition | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the distinct years in which the competitions type is not "Tournament"? | SELECT DISTINCT YEAR FROM competition WHERE Competition_type != "Tournament" | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the different years for all competitions that are not of type equal to tournament? | SELECT DISTINCT YEAR FROM competition WHERE Competition_type != "Tournament" | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the maximum and minimum number of silver medals for clubs. | SELECT max(Silver) , min(Silver) FROM club_rank | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the maximum and minimum number of silver medals for all the clubs? | SELECT max(Silver) , min(Silver) FROM club_rank | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | How many clubs have total medals less than 10? | SELECT count(*) FROM club_rank WHERE Total < 10 | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What is the total number of clubs that have less than 10 medals in total? | SELECT count(*) FROM club_rank WHERE Total < 10 | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | List all club names in ascending order of start year. | SELECT name FROM club ORDER BY Start_year ASC | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the names of all the clubs starting with the oldest? | SELECT name FROM club ORDER BY Start_year ASC | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | List all club names in descending alphabetical order. | SELECT name FROM club ORDER BY name DESC | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the names of all the clubs ordered in descending alphabetical order? | SELECT name FROM club ORDER BY name DESC | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | 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" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the names and players of all the clubs? | SELECT T1.name , T2.Player_id FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | 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" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the names of the clubs that have players in the position of "Right Wing"? | SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2.Position = "Right Wing" | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | 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 "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What is the average number of points for players from the "AIB" club? | SELECT avg(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.name = "AIB" | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | 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 "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | For each position, what is the average number of points for players in that position? | SELECT POSITION , avg(Points) FROM player GROUP BY POSITION | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | 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 "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the positions of players whose average number of points scored by that position is larger than 20? | SELECT POSITION FROM player GROUP BY name HAVING avg(Points) >= 20 | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | 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 "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the types of competition and number of competitions for that type? | SELECT Competition_type , COUNT(*) FROM competition GROUP BY Competition_type | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | List the most common type of competition. | SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What is the most common competition type? | SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | 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 "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the types of competition that have most 5 competitions for that type? | SELECT Competition_type FROM competition GROUP BY Competition_type HAVING COUNT(*) <= 5 | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | List the names of clubs that do not have any players. | SELECT name FROM CLub WHERE Club_ID NOT IN (SELECT Club_ID FROM player) | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the names of all clubs that do not have any players? | SELECT name FROM CLub WHERE Club_ID NOT IN (SELECT Club_ID FROM player) | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | 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 "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the positions of both players that have more than 20 20 points and less than 10 points? | SELECT POSITION FROM player WHERE Points > 20 INTERSECT SELECT POSITION FROM player WHERE Points < 10 | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | Show total points of all players. | SELECT sum(Points) FROM player | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What is the total number of points for all players? | SELECT sum(Points) FROM player | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | how many different positions are there? | SELECT count(DISTINCT POSITION) FROM player | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | How many different position for players are listed? | SELECT count(DISTINCT POSITION) FROM player | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | 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 "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the names of all players that got more than the average number of points? | SELECT name FROM player WHERE points > (SELECT avg(points) FROM player) | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | 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 "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What is the number of players who have points less than 30 for each position? | SELECT count(*) , POSITION FROM player WHERE points < 30 GROUP BY POSITION | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | 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 "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | what is the name of the country that participated in the most tournament competitions? | SELECT country FROM competition WHERE competition_type = 'Tournament' GROUP BY country ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | 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 "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the countries that participated in both friendly and tournament type competitions? | SELECT country FROM competition WHERE competition_type = 'Friendly' INTERSECT SELECT country FROM competition WHERE competition_type = 'Tournament' | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | 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 "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
sports_competition | What are the countries that have never participated in any friendly-type competitions? | SELECT country FROM competition EXCEPT SELECT country FROM competition WHERE competition_type = 'Friendly' | CREATE TABLE "club" (
"Club_ID" int,
"name" text,
"Region" text,
"Start_year" text,
PRIMARY KEY ("Club_ID")
)
3 rows from club table:
Club_ID name Region Start_year
1 AIB USA 2009
2 BK Slide UK 1998
3 IFG China 2005
CREATE TABLE "club_rank" (
"Rank" real,
"Club_ID" int,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real,
PRIMARY KEY ("Rank","Club_ID")
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from club_rank table:
Rank Club_ID Gold Silver Bronze Total
1.0 2 11.0 11.0 9.0 31.0
2.0 3 8.0 7.0 6.0 21.0
3.0 1 7.0 4.0 2.0 13.0
CREATE TABLE "player" (
"Player_ID" int,
"name" text,
"Position" text,
"Club_ID" int,
"Apps" real,
"Tries" real,
"Goals" text,
"Points" real,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)
)
3 rows from player table:
Player_ID name Position Club_ID Apps Tries Goals Points
1 Michael Platt Full Back 1 20.0 5.0 0 20.0
2 Dave Halley Right Wing 2 23.0 9.0 0 36.0
3 James Evans Right Centre 1 30.0 9.0 0 36.0
CREATE TABLE "competition" (
"Competition_ID" int,
"Year" real,
"Competition_type" text,
"Country" text,
PRIMARY KEY ("Competition_ID")
)
3 rows from competition table:
Competition_ID Year Competition_type Country
1 2006.0 Friendly Italy
2 2006.0 Friendly Spain
3 2006.0 Friendly Australia
CREATE TABLE "competition_result" (
"Competition_ID" int,
"Club_ID_1" int,
"Club_ID_2" int,
"Score" text,
PRIMARY KEY ("Competition_ID","Club_ID_1","Club_ID_2"),
FOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),
FOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)
)
3 rows from competition_result table:
Competition_ID Club_ID_1 Club_ID_2 Score
1 1 2 11:10
2 3 2 25:2
10 4 2 13:10
|
manufacturer | How many furniture components are there in total? | SELECT sum(num_of_component) FROM furniture | CREATE TABLE "manufacturer" (
"Manufacturer_ID" int,
"Open_Year" real,
"Name" text,
"Num_of_Factories" int,
"Num_of_Shops" int,
PRIMARY KEY ("Manufacturer_ID")
)
3 rows from manufacturer table:
Manufacturer_ID Open_Year Name Num_of_Factories Num_of_Shops
1 1980.0 Chevrolet House 36 8
2 1990.0 IKEA 21 19
3 1991.0 Ford Make 12 2
CREATE TABLE "furniture" (
"Furniture_ID" int,
"Name" text,
"Num_of_Component" int,
"Market_Rate" real,
PRIMARY KEY ("Furniture_ID")
)
3 rows from furniture table:
Furniture_ID Name Num_of_Component Market_Rate
1 Billiard table 14 52.5
2 Chabudai 4 40.0
3 Bookcase 6 1.0
CREATE TABLE "furniture_manufacte" (
"Manufacturer_ID" int,
"Furniture_ID" int,
"Price_in_Dollar" real,
PRIMARY KEY ("Manufacturer_ID","Furniture_ID"),
FOREIGN KEY ("Manufacturer_ID") REFERENCES `manufacturer`("Manufacturer_ID"),
FOREIGN KEY ("Furniture_ID") REFERENCES `furniture`("Furniture_ID")
)
3 rows from furniture_manufacte table:
Manufacturer_ID Furniture_ID Price_in_Dollar
1 3 239.0
4 2 450.0
7 7 2124.0
|
manufacturer | 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 "manufacturer" (
"Manufacturer_ID" int,
"Open_Year" real,
"Name" text,
"Num_of_Factories" int,
"Num_of_Shops" int,
PRIMARY KEY ("Manufacturer_ID")
)
3 rows from manufacturer table:
Manufacturer_ID Open_Year Name Num_of_Factories Num_of_Shops
1 1980.0 Chevrolet House 36 8
2 1990.0 IKEA 21 19
3 1991.0 Ford Make 12 2
CREATE TABLE "furniture" (
"Furniture_ID" int,
"Name" text,
"Num_of_Component" int,
"Market_Rate" real,
PRIMARY KEY ("Furniture_ID")
)
3 rows from furniture table:
Furniture_ID Name Num_of_Component Market_Rate
1 Billiard table 14 52.5
2 Chabudai 4 40.0
3 Bookcase 6 1.0
CREATE TABLE "furniture_manufacte" (
"Manufacturer_ID" int,
"Furniture_ID" int,
"Price_in_Dollar" real,
PRIMARY KEY ("Manufacturer_ID","Furniture_ID"),
FOREIGN KEY ("Manufacturer_ID") REFERENCES `manufacturer`("Manufacturer_ID"),
FOREIGN KEY ("Furniture_ID") REFERENCES `furniture`("Furniture_ID")
)
3 rows from furniture_manufacte table:
Manufacturer_ID Furniture_ID Price_in_Dollar
1 3 239.0
4 2 450.0
7 7 2124.0
|
manufacturer | 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 "manufacturer" (
"Manufacturer_ID" int,
"Open_Year" real,
"Name" text,
"Num_of_Factories" int,
"Num_of_Shops" int,
PRIMARY KEY ("Manufacturer_ID")
)
3 rows from manufacturer table:
Manufacturer_ID Open_Year Name Num_of_Factories Num_of_Shops
1 1980.0 Chevrolet House 36 8
2 1990.0 IKEA 21 19
3 1991.0 Ford Make 12 2
CREATE TABLE "furniture" (
"Furniture_ID" int,
"Name" text,
"Num_of_Component" int,
"Market_Rate" real,
PRIMARY KEY ("Furniture_ID")
)
3 rows from furniture table:
Furniture_ID Name Num_of_Component Market_Rate
1 Billiard table 14 52.5
2 Chabudai 4 40.0
3 Bookcase 6 1.0
CREATE TABLE "furniture_manufacte" (
"Manufacturer_ID" int,
"Furniture_ID" int,
"Price_in_Dollar" real,
PRIMARY KEY ("Manufacturer_ID","Furniture_ID"),
FOREIGN KEY ("Manufacturer_ID") REFERENCES `manufacturer`("Manufacturer_ID"),
FOREIGN KEY ("Furniture_ID") REFERENCES `furniture`("Furniture_ID")
)
3 rows from furniture_manufacte table:
Manufacturer_ID Furniture_ID Price_in_Dollar
1 3 239.0
4 2 450.0
7 7 2124.0
|
manufacturer | 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 "manufacturer" (
"Manufacturer_ID" int,
"Open_Year" real,
"Name" text,
"Num_of_Factories" int,
"Num_of_Shops" int,
PRIMARY KEY ("Manufacturer_ID")
)
3 rows from manufacturer table:
Manufacturer_ID Open_Year Name Num_of_Factories Num_of_Shops
1 1980.0 Chevrolet House 36 8
2 1990.0 IKEA 21 19
3 1991.0 Ford Make 12 2
CREATE TABLE "furniture" (
"Furniture_ID" int,
"Name" text,
"Num_of_Component" int,
"Market_Rate" real,
PRIMARY KEY ("Furniture_ID")
)
3 rows from furniture table:
Furniture_ID Name Num_of_Component Market_Rate
1 Billiard table 14 52.5
2 Chabudai 4 40.0
3 Bookcase 6 1.0
CREATE TABLE "furniture_manufacte" (
"Manufacturer_ID" int,
"Furniture_ID" int,
"Price_in_Dollar" real,
PRIMARY KEY ("Manufacturer_ID","Furniture_ID"),
FOREIGN KEY ("Manufacturer_ID") REFERENCES `manufacturer`("Manufacturer_ID"),
FOREIGN KEY ("Furniture_ID") REFERENCES `furniture`("Furniture_ID")
)
3 rows from furniture_manufacte table:
Manufacturer_ID Furniture_ID Price_in_Dollar
1 3 239.0
4 2 450.0
7 7 2124.0
|
manufacturer | 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 "manufacturer" (
"Manufacturer_ID" int,
"Open_Year" real,
"Name" text,
"Num_of_Factories" int,
"Num_of_Shops" int,
PRIMARY KEY ("Manufacturer_ID")
)
3 rows from manufacturer table:
Manufacturer_ID Open_Year Name Num_of_Factories Num_of_Shops
1 1980.0 Chevrolet House 36 8
2 1990.0 IKEA 21 19
3 1991.0 Ford Make 12 2
CREATE TABLE "furniture" (
"Furniture_ID" int,
"Name" text,
"Num_of_Component" int,
"Market_Rate" real,
PRIMARY KEY ("Furniture_ID")
)
3 rows from furniture table:
Furniture_ID Name Num_of_Component Market_Rate
1 Billiard table 14 52.5
2 Chabudai 4 40.0
3 Bookcase 6 1.0
CREATE TABLE "furniture_manufacte" (
"Manufacturer_ID" int,
"Furniture_ID" int,
"Price_in_Dollar" real,
PRIMARY KEY ("Manufacturer_ID","Furniture_ID"),
FOREIGN KEY ("Manufacturer_ID") REFERENCES `manufacturer`("Manufacturer_ID"),
FOREIGN KEY ("Furniture_ID") REFERENCES `furniture`("Furniture_ID")
)
3 rows from furniture_manufacte table:
Manufacturer_ID Furniture_ID Price_in_Dollar
1 3 239.0
4 2 450.0
7 7 2124.0
|
manufacturer | 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 "manufacturer" (
"Manufacturer_ID" int,
"Open_Year" real,
"Name" text,
"Num_of_Factories" int,
"Num_of_Shops" int,
PRIMARY KEY ("Manufacturer_ID")
)
3 rows from manufacturer table:
Manufacturer_ID Open_Year Name Num_of_Factories Num_of_Shops
1 1980.0 Chevrolet House 36 8
2 1990.0 IKEA 21 19
3 1991.0 Ford Make 12 2
CREATE TABLE "furniture" (
"Furniture_ID" int,
"Name" text,
"Num_of_Component" int,
"Market_Rate" real,
PRIMARY KEY ("Furniture_ID")
)
3 rows from furniture table:
Furniture_ID Name Num_of_Component Market_Rate
1 Billiard table 14 52.5
2 Chabudai 4 40.0
3 Bookcase 6 1.0
CREATE TABLE "furniture_manufacte" (
"Manufacturer_ID" int,
"Furniture_ID" int,
"Price_in_Dollar" real,
PRIMARY KEY ("Manufacturer_ID","Furniture_ID"),
FOREIGN KEY ("Manufacturer_ID") REFERENCES `manufacturer`("Manufacturer_ID"),
FOREIGN KEY ("Furniture_ID") REFERENCES `furniture`("Furniture_ID")
)
3 rows from furniture_manufacte table:
Manufacturer_ID Furniture_ID Price_in_Dollar
1 3 239.0
4 2 450.0
7 7 2124.0
|
manufacturer | 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" (
"Manufacturer_ID" int,
"Open_Year" real,
"Name" text,
"Num_of_Factories" int,
"Num_of_Shops" int,
PRIMARY KEY ("Manufacturer_ID")
)
3 rows from manufacturer table:
Manufacturer_ID Open_Year Name Num_of_Factories Num_of_Shops
1 1980.0 Chevrolet House 36 8
2 1990.0 IKEA 21 19
3 1991.0 Ford Make 12 2
CREATE TABLE "furniture" (
"Furniture_ID" int,
"Name" text,
"Num_of_Component" int,
"Market_Rate" real,
PRIMARY KEY ("Furniture_ID")
)
3 rows from furniture table:
Furniture_ID Name Num_of_Component Market_Rate
1 Billiard table 14 52.5
2 Chabudai 4 40.0
3 Bookcase 6 1.0
CREATE TABLE "furniture_manufacte" (
"Manufacturer_ID" int,
"Furniture_ID" int,
"Price_in_Dollar" real,
PRIMARY KEY ("Manufacturer_ID","Furniture_ID"),
FOREIGN KEY ("Manufacturer_ID") REFERENCES `manufacturer`("Manufacturer_ID"),
FOREIGN KEY ("Furniture_ID") REFERENCES `furniture`("Furniture_ID")
)
3 rows from furniture_manufacte table:
Manufacturer_ID Furniture_ID Price_in_Dollar
1 3 239.0
4 2 450.0
7 7 2124.0
|
manufacturer | 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" (
"Manufacturer_ID" int,
"Open_Year" real,
"Name" text,
"Num_of_Factories" int,
"Num_of_Shops" int,
PRIMARY KEY ("Manufacturer_ID")
)
3 rows from manufacturer table:
Manufacturer_ID Open_Year Name Num_of_Factories Num_of_Shops
1 1980.0 Chevrolet House 36 8
2 1990.0 IKEA 21 19
3 1991.0 Ford Make 12 2
CREATE TABLE "furniture" (
"Furniture_ID" int,
"Name" text,
"Num_of_Component" int,
"Market_Rate" real,
PRIMARY KEY ("Furniture_ID")
)
3 rows from furniture table:
Furniture_ID Name Num_of_Component Market_Rate
1 Billiard table 14 52.5
2 Chabudai 4 40.0
3 Bookcase 6 1.0
CREATE TABLE "furniture_manufacte" (
"Manufacturer_ID" int,
"Furniture_ID" int,
"Price_in_Dollar" real,
PRIMARY KEY ("Manufacturer_ID","Furniture_ID"),
FOREIGN KEY ("Manufacturer_ID") REFERENCES `manufacturer`("Manufacturer_ID"),
FOREIGN KEY ("Furniture_ID") REFERENCES `furniture`("Furniture_ID")
)
3 rows from furniture_manufacte table:
Manufacturer_ID Furniture_ID Price_in_Dollar
1 3 239.0
4 2 450.0
7 7 2124.0
|
manufacturer | List all manufacturer names and ids ordered by their opening year. | SELECT name , manufacturer_id FROM manufacturer ORDER BY open_year | CREATE TABLE "manufacturer" (
"Manufacturer_ID" int,
"Open_Year" real,
"Name" text,
"Num_of_Factories" int,
"Num_of_Shops" int,
PRIMARY KEY ("Manufacturer_ID")
)
3 rows from manufacturer table:
Manufacturer_ID Open_Year Name Num_of_Factories Num_of_Shops
1 1980.0 Chevrolet House 36 8
2 1990.0 IKEA 21 19
3 1991.0 Ford Make 12 2
CREATE TABLE "furniture" (
"Furniture_ID" int,
"Name" text,
"Num_of_Component" int,
"Market_Rate" real,
PRIMARY KEY ("Furniture_ID")
)
3 rows from furniture table:
Furniture_ID Name Num_of_Component Market_Rate
1 Billiard table 14 52.5
2 Chabudai 4 40.0
3 Bookcase 6 1.0
CREATE TABLE "furniture_manufacte" (
"Manufacturer_ID" int,
"Furniture_ID" int,
"Price_in_Dollar" real,
PRIMARY KEY ("Manufacturer_ID","Furniture_ID"),
FOREIGN KEY ("Manufacturer_ID") REFERENCES `manufacturer`("Manufacturer_ID"),
FOREIGN KEY ("Furniture_ID") REFERENCES `furniture`("Furniture_ID")
)
3 rows from furniture_manufacte table:
Manufacturer_ID Furniture_ID Price_in_Dollar
1 3 239.0
4 2 450.0
7 7 2124.0
|
manufacturer | Give me the name and year of opening of the manufacturers that have either less than 10 factories or more than 10 shops. | SELECT name , open_year FROM manufacturer WHERE num_of_shops > 10 OR Num_of_Factories < 10 | CREATE TABLE "manufacturer" (
"Manufacturer_ID" int,
"Open_Year" real,
"Name" text,
"Num_of_Factories" int,
"Num_of_Shops" int,
PRIMARY KEY ("Manufacturer_ID")
)
3 rows from manufacturer table:
Manufacturer_ID Open_Year Name Num_of_Factories Num_of_Shops
1 1980.0 Chevrolet House 36 8
2 1990.0 IKEA 21 19
3 1991.0 Ford Make 12 2
CREATE TABLE "furniture" (
"Furniture_ID" int,
"Name" text,
"Num_of_Component" int,
"Market_Rate" real,
PRIMARY KEY ("Furniture_ID")
)
3 rows from furniture table:
Furniture_ID Name Num_of_Component Market_Rate
1 Billiard table 14 52.5
2 Chabudai 4 40.0
3 Bookcase 6 1.0
CREATE TABLE "furniture_manufacte" (
"Manufacturer_ID" int,
"Furniture_ID" int,
"Price_in_Dollar" real,
PRIMARY KEY ("Manufacturer_ID","Furniture_ID"),
FOREIGN KEY ("Manufacturer_ID") REFERENCES `manufacturer`("Manufacturer_ID"),
FOREIGN KEY ("Furniture_ID") REFERENCES `furniture`("Furniture_ID")
)
3 rows from furniture_manufacte table:
Manufacturer_ID Furniture_ID Price_in_Dollar
1 3 239.0
4 2 450.0
7 7 2124.0
|
manufacturer | what is the average number of factories and maximum number of shops for manufacturers that opened before 1990. | SELECT max(num_of_shops) , avg(Num_of_Factories) FROM manufacturer WHERE open_year < 1990 | CREATE TABLE "manufacturer" (
"Manufacturer_ID" int,
"Open_Year" real,
"Name" text,
"Num_of_Factories" int,
"Num_of_Shops" int,
PRIMARY KEY ("Manufacturer_ID")
)
3 rows from manufacturer table:
Manufacturer_ID Open_Year Name Num_of_Factories Num_of_Shops
1 1980.0 Chevrolet House 36 8
2 1990.0 IKEA 21 19
3 1991.0 Ford Make 12 2
CREATE TABLE "furniture" (
"Furniture_ID" int,
"Name" text,
"Num_of_Component" int,
"Market_Rate" real,
PRIMARY KEY ("Furniture_ID")
)
3 rows from furniture table:
Furniture_ID Name Num_of_Component Market_Rate
1 Billiard table 14 52.5
2 Chabudai 4 40.0
3 Bookcase 6 1.0
CREATE TABLE "furniture_manufacte" (
"Manufacturer_ID" int,
"Furniture_ID" int,
"Price_in_Dollar" real,
PRIMARY KEY ("Manufacturer_ID","Furniture_ID"),
FOREIGN KEY ("Manufacturer_ID") REFERENCES `manufacturer`("Manufacturer_ID"),
FOREIGN KEY ("Furniture_ID") REFERENCES `furniture`("Furniture_ID")
)
3 rows from furniture_manufacte table:
Manufacturer_ID Furniture_ID Price_in_Dollar
1 3 239.0
4 2 450.0
7 7 2124.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.