human
Schema:
class (CLASS_CODE, CRS_CODE, CLASS_SECTION, CLASS_TIME, CLASS_ROOM, PROF_NUM)
course (CRS_CODE, DEPT_CODE, CRS_DESCRIPTION, CRS_CREDIT)
department (DEPT_CODE, DEPT_NAME, SCHOOL_CODE, EMP_NUM, DEPT_ADDRESS, DEPT_EXTENSION)
employee (EMP_NUM, EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_JOBCODE, EMP_HIREDATE, EMP_DOB)
enroll (CLASS_CODE, STU_NUM, ENROLL_GRADE)
professor (EMP_NUM, DEPT_CODE, PROF_OFFICE, PROF_EXTENSION, PROF_HIGH_DEGREE)
student (STU_NUM, STU_LNAME, STU_FNAME, STU_INIT, STU_DOB, STU_HRS, STU_CLASS, STU_GPA, STU_TRANSFER, DEPT_CODE, STU_PHONE, PROF_NUM)
Please answer with SQL.
assistant
Sure, I understand.
human
How many professors are teaching class with code ACCT-211?
assistant
SELECT count(DISTINCT PROF_NUM) FROM CLASS WHERE CRS_CODE = 'ACCT-211'
human
how many schools exist in total?
assistant
SELECT count(DISTINCT school_code) FROM department
human
List the codes of all courses that take place in room KLR209.
assistant
SELECT class_code FROM CLASS WHERE class_room = 'KLR209'
human
What is the code of the school where the accounting department belongs to?
assistant
SELECT school_code FROM department WHERE dept_name = 'Accounting'
human
How many different locations does each school have?
assistant
SELECT count(DISTINCT dept_address) , school_code FROM department GROUP BY school_code
human
What are the different locations of the school with the code BUS?
assistant
SELECT COUNT( DISTINCT dept_address ) FROM department WHERE school_code = "BUS" ;