Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What is the name, address, and number of students in the departments that have the 3 most students? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: Find the first name and office of the professor who is in the history department and has a Ph.D. degree. [/INST]

Output: 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.';


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What are the first names and office of the professors who are in the history department and have a Ph.D? [/INST]

Output: 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.';


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: Find the first names of all instructors who have taught some course and the course code. [/INST]

Output: SELECT T2.emp_fname ,  T1.crs_code FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num  =  T2.emp_num;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What are the first names of all teachers who have taught a course and the corresponding course codes? [/INST]

Output: SELECT T2.emp_fname ,  T1.crs_code FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num  =  T2.emp_num;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: Find the first names of all instructors who have taught some course and the course description. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What are the first names of all teachers who have taught a course and the corresponding descriptions? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: Find the first names and offices of all instructors who have taught some course and also find the course description. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What are the first names, office locations of all lecturers who have taught some course? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: Find the first names and offices of all instructors who have taught some course and the course description and the department name. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What are the first names, office locations, and departments of all instructors, and also what are the descriptions of the courses they teach? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: Find names of all students who took some course and the course description. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What are the names of all students who took a class and the corresponding course descriptions? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: Find names of all students who took some course and got A or C. [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What are the names of all students taking a course who received an A or C? [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: Find the first names of all professors in the Accounting department who is teaching some course and the class room. [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What are the first names of all Accounting professors who teach and what are the classrooms of the courses they teach? [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: Find the first names and degree of all professors who are teaching some class in Computer Info. Systems department. [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What are the different first names and highest degree attained for professors teaching in the Computer Information Systems department? [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What is the last name of the student who got a grade A in the class with code 10018. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What is the last name of the student who received an A in the class with the code 10018? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: Find the first name and office of history professor who did not get a Ph.D. degree. [/INST]

Output: 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.';


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What are the first names and offices of history professors who don't have Ph.D.s? [/INST]

Output: 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.';


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: Find the first names of professors who are teaching more than one class. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What are the first names of all professors who teach more than one class? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: Find the first names of students who took exactly one class. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What are the first names of student who only took one course? [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: Find the name of department that offers the class whose description has the word "Statistics". [/INST]

Output: 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%';


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What is the name of the department that offers a course that has a description including the word "Statistics"? [/INST]

Output: 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%';


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What is the first name of the student whose last name starting with the letter S and is taking ACCT-211 class? [/INST]

Output: 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%';


Input:
[INST] Here is a database schema:
CLASS :
CLASS_CODE [ TEXT ] primary_key
CRS_CODE [ TEXT ] CLASS.CRS_CODE = COURSE.CRS_CODE
CLASS_SECTION [ TEXT ]
CLASS_TIME [ TEXT ]
CLASS_ROOM [ TEXT ]
PROF_NUM [ INT ] CLASS.PROF_NUM = EMPLOYEE.EMP_NUM

COURSE :
CRS_CODE [ TEXT ] primary_key
DEPT_CODE [ TEXT ] COURSE.DEPT_CODE = DEPARTMENT.DEPT_CODE
CRS_DESCRIPTION [ TEXT ]
CRS_CREDIT [ INT ]

DEPARTMENT :
DEPT_CODE [ TEXT ] primary_key
DEPT_NAME [ TEXT ]
SCHOOL_CODE [ TEXT ]
EMP_NUM [ INT ] DEPARTMENT.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_ADDRESS [ TEXT ]
DEPT_EXTENSION [ TEXT ]

EMPLOYEE :
EMP_NUM [ INT ] primary_key
EMP_LNAME [ TEXT ]
EMP_FNAME [ TEXT ]
EMP_INITIAL [ TEXT ]
EMP_JOBCODE [ TEXT ]
EMP_HIREDATE [ TEXT ]
EMP_DOB [ TEXT ]

ENROLL :
CLASS_CODE [ TEXT ] ENROLL.CLASS_CODE = CLASS.CLASS_CODE
STU_NUM [ INT ] ENROLL.STU_NUM = STUDENT.STU_NUM
ENROLL_GRADE [ TEXT ]

PROFESSOR :
EMP_NUM [ INT ] PROFESSOR.EMP_NUM = EMPLOYEE.EMP_NUM
DEPT_CODE [ TEXT ] PROFESSOR.DEPT_CODE = DEPARTMENT.DEPT_CODE
PROF_OFFICE [ TEXT ]
PROF_EXTENSION [ TEXT ]
PROF_HIGH_DEGREE [ TEXT ]

STUDENT :
STU_NUM [ INT ] primary_key
STU_LNAME [ TEXT ]
STU_FNAME [ TEXT ]
STU_INIT [ TEXT ]
STU_DOB [ TEXT ]
STU_HRS [ INT ]
STU_CLASS [ TEXT ]
STU_GPA [ INT ]
STU_TRANSFER [ INT ]
DEPT_CODE [ TEXT ] STUDENT.DEPT_CODE = DEPARTMENT.DEPT_CODE
STU_PHONE [ TEXT ]
PROF_NUM [ INT ]

Please write me a SQL statement that answers the following question: What is the first name of the student whose last name starts with the letter S and is taking ACCT-211? [/INST]

Output: 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%';


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: How many clubs are there? [/INST]

Output: SELECT count(*) FROM club;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What is the total number of clubs? [/INST]

Output: SELECT count(*) FROM club;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: List the distinct region of clubs in ascending alphabetical order. [/INST]

Output: SELECT DISTINCT Region FROM club ORDER BY Region ASC;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the different regions of clubs in ascending alphabetical order? [/INST]

Output: SELECT DISTINCT Region FROM club ORDER BY Region ASC;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average number of gold medals for clubs? [/INST]

Output: SELECT avg(Gold) FROM club_rank;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average number of gold medals for a club? [/INST]

Output: SELECT avg(Gold) FROM club_rank;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the types and countries of competitions? [/INST]

Output: SELECT Competition_type ,  Country FROM competition;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the types of every competition and in which countries are they located? [/INST]

Output: SELECT Competition_type ,  Country FROM competition;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the distinct years in which the competitions type is not "Tournament"? [/INST]

Output: SELECT DISTINCT YEAR FROM competition WHERE Competition_type != "Tournament";


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the different years for all competitions that are not of type equal to tournament? [/INST]

Output: SELECT DISTINCT YEAR FROM competition WHERE Competition_type != "Tournament";


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the maximum and minimum number of silver medals for clubs. [/INST]

Output: SELECT max(Silver) ,  min(Silver) FROM club_rank;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the maximum and minimum number of silver medals for all the clubs? [/INST]

Output: SELECT max(Silver) ,  min(Silver) FROM club_rank;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: How many clubs have total medals less than 10? [/INST]

Output: SELECT count(*) FROM club_rank WHERE Total  <  10;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What is the total number of clubs that have less than 10 medals in total? [/INST]

Output: SELECT count(*) FROM club_rank WHERE Total  <  10;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: List all club names in ascending order of start year. [/INST]

Output: SELECT name FROM club ORDER BY Start_year ASC;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all the clubs starting with the oldest? [/INST]

Output: SELECT name FROM club ORDER BY Start_year ASC;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: List all club names in descending alphabetical order. [/INST]

Output: SELECT name FROM club ORDER BY name DESC;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all the clubs ordered in descending alphabetical order? [/INST]

Output: SELECT name FROM club ORDER BY name DESC;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: Please show the names and the players of clubs. [/INST]

Output: SELECT T1.name ,  T2.Player_id FROM club AS T1 JOIN player AS T2 ON T1.Club_ID  =  T2.Club_ID;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names and players of all the clubs? [/INST]

Output: SELECT T1.name ,  T2.Player_id FROM club AS T1 JOIN player AS T2 ON T1.Club_ID  =  T2.Club_ID;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of clubs that have players with position "Right Wing". [/INST]

Output: SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID  =  T2.Club_ID WHERE T2.Position  =  "Right Wing";


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of the clubs that have players in the position of "Right Wing"? [/INST]

Output: SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID  =  T2.Club_ID WHERE T2.Position  =  "Right Wing";


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average points of players from club with name "AIB". [/INST]

Output: SELECT avg(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID  =  T2.Club_ID WHERE T1.name  =  "AIB";


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average number of points for players from the "AIB" club? [/INST]

Output: SELECT avg(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID  =  T2.Club_ID WHERE T1.name  =  "AIB";


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: List the position of players and the average number of points of players of each position. [/INST]

Output: SELECT POSITION ,  avg(Points) FROM player GROUP BY POSITION;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: For each position, what is the average number of points for players in that position? [/INST]

Output: SELECT POSITION ,  avg(Points) FROM player GROUP BY POSITION;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: List the position of players with average number of points scored by players of that position bigger than 20. [/INST]

Output: SELECT POSITION FROM player GROUP BY name HAVING avg(Points)  >=  20;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the positions of players whose average number of points scored by that position is larger than 20? [/INST]

Output: SELECT POSITION FROM player GROUP BY name HAVING avg(Points)  >=  20;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: List the types of competition and the number of competitions of each type. [/INST]

Output: SELECT Competition_type ,  COUNT(*) FROM competition GROUP BY Competition_type;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the types of competition and number of competitions for that type? [/INST]

Output: SELECT Competition_type ,  COUNT(*) FROM competition GROUP BY Competition_type;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: List the most common type of competition. [/INST]

Output: SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What is the most common competition type? [/INST]

Output: SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: List the types of competition that have at most five competitions of that type. [/INST]

Output: SELECT Competition_type FROM competition GROUP BY Competition_type HAVING COUNT(*)  <=  5;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the types of competition that have most 5 competitions for that type? [/INST]

Output: SELECT Competition_type FROM competition GROUP BY Competition_type HAVING COUNT(*)  <=  5;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: List the names of clubs that do not have any players. [/INST]

Output: SELECT name FROM CLub WHERE Club_ID NOT IN (SELECT Club_ID FROM player);


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all clubs that do not have any players? [/INST]

Output: SELECT name FROM CLub WHERE Club_ID NOT IN (SELECT Club_ID FROM player);


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the positions with both players having more than 20 points and less than 10 points. [/INST]

Output: SELECT POSITION FROM player WHERE Points  >  20 INTERSECT SELECT POSITION FROM player WHERE Points  <  10;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the positions of both players that have more than 20 20 points and less than 10 points? [/INST]

Output: SELECT POSITION FROM player WHERE Points  >  20 INTERSECT SELECT POSITION FROM player WHERE Points  <  10;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: Show total points of all players. [/INST]

Output: SELECT sum(Points) FROM player;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What is the total number of points for all players? [/INST]

Output: SELECT sum(Points) FROM player;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: how many different positions are there? [/INST]

Output: SELECT count(DISTINCT POSITION) FROM player;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: How many different position for players are listed? [/INST]

Output: SELECT count(DISTINCT POSITION) FROM player;


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: what are the name of players who get more than the average points. [/INST]

Output: SELECT name FROM player WHERE points  >  (SELECT avg(points) FROM player);


Input:
[INST] Here is a database schema:
club :
Club_ID [ INT ] primary_key
name [ TEXT ]
Region [ TEXT ]
Start_year [ TEXT ]

club_rank :
Rank [ INT ] primary_key
Club_ID [ INT ] club_rank.Club_ID = club.Club_ID
Gold [ INT ]
Silver [ INT ]
Bronze [ INT ]
Total [ INT ]

player :
Player_ID [ INT ] primary_key
name [ TEXT ]
Position [ TEXT ]
Club_ID [ INT ] player.Club_ID = club.Club_ID
Apps [ INT ]
Tries [ INT ]
Goals [ TEXT ]
Points [ INT ]

competition :
Competition_ID [ INT ] primary_key
Year [ INT ]
Competition_type [ TEXT ]
Country [ TEXT ]

competition_result :
Competition_ID [ INT ] primary_key competition_result.Competition_ID = competition.Competition_ID
Club_ID_1 [ INT ] competition_result.Club_ID_1 = club.Club_ID
Club_ID_2 [ INT ] competition_result.Club_ID_2 = club.Club_ID
Score [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of all players that got more than the average number of points? [/INST]

Output: SELECT name FROM player WHERE points  >  (SELECT avg(points) FROM player);