SQL
stringlengths 18
577
| question
stringlengths 317
11.5k
|
---|---|
SELECT count(*) , dept_code FROM CLASS AS T1 JOIN course AS T2 ON T1.crs_code = T2.crs_code GROUP BY dept_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the number of classes in each department.
|
SELECT count(*) , dept_code FROM CLASS AS T1 JOIN course AS T2 ON T1.crs_code = T2.crs_code GROUP BY dept_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many classes are held in each department?
|
SELECT count(*) , T3.school_code FROM CLASS AS T1 JOIN course AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T2.dept_code = T3.dept_code GROUP BY T3.school_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the number of classes in each school.
|
SELECT count(*) , T3.school_code FROM CLASS AS T1 JOIN course AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T2.dept_code = T3.dept_code GROUP BY T3.school_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many classes exist for each school?
|
SELECT count(*) , T1.school_code FROM department AS T1 JOIN professor AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.school_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the number of professors for different school?
|
SELECT count(*) , T1.school_code FROM department AS T1 JOIN professor AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.school_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many different professors are there for the different schools?
|
SELECT emp_jobcode , count(*) FROM employee GROUP BY emp_jobcode ORDER BY count(*) DESC LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the count and code of the job has most employees.
|
SELECT emp_jobcode , count(*) FROM employee GROUP BY emp_jobcode ORDER BY count(*) DESC LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the count and code of the job with the most employee?
|
SELECT T1.school_code FROM department AS T1 JOIN professor AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.school_code ORDER BY count(*) LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which school has the smallest amount of professors?
|
SELECT T1.school_code FROM department AS T1 JOIN professor AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.school_code ORDER BY count(*) LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which school has the fewest professors?
|
SELECT count(*) , dept_code FROM professor WHERE prof_high_degree = 'Ph.D.' GROUP BY dept_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the number of professors with a Ph.D. degree in each department.
|
SELECT count(*) , dept_code FROM professor WHERE prof_high_degree = 'Ph.D.' GROUP BY dept_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many professors have a Ph.D. in each department?
|
SELECT count(*) , dept_code FROM student GROUP BY dept_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the number of students for each department.
|
SELECT count(*) , dept_code FROM student GROUP BY dept_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many students are in each department?
|
SELECT sum(stu_hrs) , dept_code FROM student GROUP BY dept_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the total number of hours have done for all students in each department.
|
SELECT sum(stu_hrs) , dept_code FROM student GROUP BY dept_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many hours do the students spend studying in each department?
|
SELECT max(stu_gpa) , avg(stu_gpa) , min(stu_gpa) , dept_code FROM student GROUP BY dept_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the max, average, and minimum gpa of all students in each department.
|
SELECT max(stu_gpa) , avg(stu_gpa) , min(stu_gpa) , dept_code FROM student GROUP BY dept_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the highest, lowest, and average student GPA for every department?
|
SELECT T2.dept_name , avg(T1.stu_gpa) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY avg(T1.stu_gpa) DESC LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the name and the average gpa of department whose students have the highest average gpa?
|
SELECT T2.dept_name , avg(T1.stu_gpa) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY avg(T1.stu_gpa) DESC LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which department has the highest average student GPA, and what is the average gpa?
|
SELECT count(DISTINCT school_code) FROM department
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. how many schools exist in total?
|
SELECT count(DISTINCT school_code) FROM department
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many schools are there in the department?
|
SELECT count(DISTINCT class_code) FROM CLASS
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many different classes are there?
|
SELECT count(DISTINCT class_code) FROM CLASS
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many unique classes are offered?
|
SELECT count(DISTINCT crs_code) FROM CLASS
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many courses are offered?
|
SELECT count(DISTINCT crs_code) FROM CLASS
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the number of different course codes?
|
SELECT count(DISTINCT dept_name) FROM department
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many departments does the college has?
|
SELECT count(DISTINCT dept_name) FROM department
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many different departments are there?
|
SELECT count(*) FROM department AS T1 JOIN course AS T2 ON T1.dept_code = T2.dept_code WHERE dept_name = "Computer Info. Systems"
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many courses are offered by the Computer Info. Systems department?
|
SELECT count(*) FROM department AS T1 JOIN course AS T2 ON T1.dept_code = T2.dept_code WHERE dept_name = "Computer Info. Systems"
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many courses does the department of Computer Information Systmes offer?
|
SELECT count(DISTINCT class_section) FROM CLASS WHERE crs_code = 'ACCT-211'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many sections does course ACCT-211 has?
|
SELECT count(DISTINCT class_section) FROM CLASS WHERE crs_code = 'ACCT-211'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the number of different class sections offered in the course ACCT-211?
|
SELECT sum(T1.crs_credit) , T1.dept_code FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code GROUP BY T1.dept_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the total credits of all classes offered by each department.
|
SELECT sum(T1.crs_credit) , T1.dept_code FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code GROUP BY T1.dept_code
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the total number of credits offered by each department?
|
SELECT T3.dept_name FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T1.dept_code = T3.dept_code GROUP BY T1.dept_code ORDER BY sum(T1.crs_credit) DESC LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the name of the department that offers the largest number of credits of all classes.
|
SELECT T3.dept_name FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T1.dept_code = T3.dept_code GROUP BY T1.dept_code ORDER BY sum(T1.crs_credit) DESC LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which department offers the most credits all together?
|
SELECT count(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code WHERE T1.crs_code = 'ACCT-211'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many students enrolled in class ACCT-211?
|
SELECT count(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code WHERE T1.crs_code = 'ACCT-211'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the total number of students enrolled in ACCT-211?
|
SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the first name of each student enrolled in class ACCT-211?
|
SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names of all students in course ACCT-211?
|
SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211' AND T2.enroll_grade = 'C'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the first name of students enrolled in class ACCT-211 and got grade C?
|
SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211' AND T2.enroll_grade = 'C'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names of all students who took ACCT-211 and received a C?
|
SELECT count(*) FROM employee
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the total number of employees.
|
SELECT count(*) FROM employee
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many employees are there all together?
|
SELECT count(*) FROM professor WHERE prof_high_degree = 'Ph.D.'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many professors do have a Ph.D. degree?
|
SELECT count(*) FROM professor WHERE prof_high_degree = 'Ph.D.'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the total number of professors with a Ph.D. ?
|
SELECT count(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN department AS T4 ON T3.dept_code = T4.dept_code WHERE T4.dept_name = 'Accounting'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many students are enrolled in the class taught by some professor from the accounting department?
|
SELECT count(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN department AS T4 ON T3.dept_code = T4.dept_code WHERE T4.dept_name = 'Accounting'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many students are enrolled in some classes that are taught by an accounting professor?
|
SELECT T4.dept_name FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN department AS T4 ON T3.dept_code = T4.dept_code GROUP BY T3.dept_code ORDER BY count(*) DESC LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the name of the department that has the largest number of students enrolled?
|
SELECT T4.dept_name FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN department AS T4 ON T3.dept_code = T4.dept_code GROUP BY T3.dept_code ORDER BY count(*) DESC LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the name of the department with the most students enrolled?
|
SELECT dept_name FROM department ORDER BY dept_name
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. list names of all departments ordered by their names.
|
SELECT dept_name FROM department ORDER BY dept_name
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of all departments in alphabetical order?
|
SELECT class_code FROM CLASS WHERE class_room = 'KLR209'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. List the codes of all courses that take place in room KLR209.
|
SELECT class_code FROM CLASS WHERE class_room = 'KLR209'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the codes of all the courses that are located in room KLR209?
|
SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. List the first name of all employees with job code PROF ordered by their date of birth.
|
SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names of all employees that are professors ordered by date of birth?
|
SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the first names and offices of all professors sorted by alphabetical order of their first name.
|
SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names and office locations for all professors sorted alphabetically by first name?
|
SELECT emp_fname , emp_lname FROM employee ORDER BY emp_dob LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the first and last name of the oldest employee?
|
SELECT emp_fname , emp_lname FROM employee ORDER BY emp_dob LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first and last names of the employee with the earliest date of birth?
|
SELECT stu_fname , stu_lname , stu_gpa FROM student WHERE stu_gpa > 3 ORDER BY stu_dob DESC LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the first, last name, gpa of the youngest one among students whose GPA is above 3?
|
SELECT stu_fname , stu_lname , stu_gpa FROM student WHERE stu_gpa > 3 ORDER BY stu_dob DESC LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the first and last name of the youngest student with a GPA above 3, and what is their GPA?
|
SELECT DISTINCT stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE enroll_grade = 'C'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the first name of students who got grade C in any class?
|
SELECT DISTINCT stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE enroll_grade = 'C'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names of all students who got a grade C in a class?
|
SELECT T2.dept_name FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the name of department where has the smallest number of professors?
|
SELECT T2.dept_name FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the name of the department with the fewest professors?
|
SELECT T2.dept_name , T1.dept_code FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.prof_high_degree = 'Ph.D.' GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the name of department where has the largest number of professors with a Ph.D. degree?
|
SELECT T2.dept_name , T1.dept_code FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.prof_high_degree = 'Ph.D.' GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which department has the most professors with a Ph.D.?
|
SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' EXCEPT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names of the professors who do not teach a class.
|
SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' EXCEPT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names of all professors not teaching any classes?
|
SELECT T1.emp_fname FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History' EXCEPT SELECT T4.emp_fname FROM employee AS T4 JOIN CLASS AS T5 ON T4.emp_num = T5.prof_num
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the first names of the professors from the history department who do not teach a class.
|
SELECT T1.emp_fname FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History' EXCEPT SELECT T4.emp_fname FROM employee AS T4 JOIN CLASS AS T5 ON T4.emp_num = T5.prof_num
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names of all history professors who do not teach?
|
SELECT T1.emp_lname , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the last name and office of the professor from the history department?
|
SELECT T1.emp_lname , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the last name and office of all history professors?
|
SELECT T3.dept_name , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T1.emp_lname = 'Heffington'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is department name and office for the professor whose last name is Heffington?
|
SELECT T3.dept_name , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T1.emp_lname = 'Heffington'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the name of the department and office location for the professor with the last name of Heffington?
|
SELECT T1.emp_lname , T1.emp_hiredate FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num WHERE T2.prof_office = 'DRE 102'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the last name and hire date of the professor who is in office DRE 102.
|
SELECT T1.emp_lname , T1.emp_hiredate FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num WHERE T2.prof_office = 'DRE 102'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the last name of the professor whose office is located in DRE 102, and when were they hired?
|
SELECT T1.crs_code FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num WHERE T3.stu_lname = 'Smithson'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the code of the course which the student whose last name is Smithson took?
|
SELECT T1.crs_code FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num WHERE T3.stu_lname = 'Smithson'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the course codes for every class that the student with the last name Smithson took?
|
SELECT T4.crs_description , T4.crs_credit FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num JOIN course AS T4 ON T4.crs_code = T1.crs_code WHERE T3.stu_lname = 'Smithson'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the description and credit of the course which the student whose last name is Smithson took?
|
SELECT T4.crs_description , T4.crs_credit FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num JOIN course AS T4 ON T4.crs_code = T1.crs_code WHERE T3.stu_lname = 'Smithson'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many credits is the course that the student with the last name Smithson took, and what is its description?
|
SELECT count(*) FROM professor WHERE prof_high_degree = 'Ph.D.' OR prof_high_degree = 'MA'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many professors who has a either Ph.D. or MA degree?
|
SELECT count(*) FROM professor WHERE prof_high_degree = 'Ph.D.' OR prof_high_degree = 'MA'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many professors attained either Ph.D. or Masters degrees?
|
SELECT count(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T2.dept_name = 'Accounting' OR T2.dept_name = 'Biology'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many professors who are from either Accounting or Biology department?
|
SELECT count(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T2.dept_name = 'Accounting' OR T2.dept_name = 'Biology'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the number of professors who are in the Accounting or Biology departments?
|
SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'CIS-220' INTERSECT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'QM-261'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the first name of the professor who is teaching two courses with code CIS-220 and QM-261.
|
SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'CIS-220' INTERSECT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'QM-261'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the first name of the professor who is teaching CIS-220 and QM-261?
|
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 JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Accounting' INTERSECT 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 JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Computer Info. Systems'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the first name of student who is taking classes from accounting and Computer Info. Systems departments
|
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 JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Accounting' INTERSECT 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 JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Computer Info. Systems'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names of all students taking accoutning and Computer Information Systems classes?
|
SELECT avg(T2.stu_gpa) FROM enroll AS T1 JOIN student AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T1.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the average gpa of the students enrolled in the course with code ACCT-211?
|
SELECT avg(T2.stu_gpa) FROM enroll AS T1 JOIN student AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T1.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211'
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the average GPA of students taking ACCT-211?
|
SELECT stu_gpa , stu_phone , stu_fname FROM student ORDER BY stu_gpa DESC LIMIT 5
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the first name, gpa and phone number of the top 5 students with highest gpa?
|
SELECT stu_gpa , stu_phone , stu_fname FROM student ORDER BY stu_gpa DESC LIMIT 5
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the first name, GPA, and phone number of the students with the top 5 GPAs?
|
SELECT T2.dept_name FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code ORDER BY stu_gpa LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the department name of the students with lowest gpa belongs to?
|
SELECT T2.dept_name FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code ORDER BY stu_gpa LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the name of the department with the student that has the lowest GPA?
|
SELECT stu_fname , stu_gpa FROM student WHERE stu_gpa < (SELECT avg(stu_gpa) FROM student)
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the first name and gpa of the students whose gpa is lower than the average gpa of all students.
|
SELECT stu_fname , stu_gpa FROM student WHERE stu_gpa < (SELECT avg(stu_gpa) FROM student)
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the first name and GPA of every student that has a GPA lower than average?
|
SELECT T2.dept_name , T2.dept_address FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the name and address of the department that has the highest number of students.
|
SELECT T2.dept_name , T2.dept_address FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 1
|
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the name and address of the department with the most students?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.