Database: college_1

Question: What are the first names of all students in course ACCT-211?
SQL: 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'

Question: What are the first names of all students who took ACCT-211 and received a C?
SQL: 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'

Question: How many employees are there all together?
SQL: SELECT count(*) FROM employee

Question: What is the total number of professors with a Ph.D. ?
SQL: SELECT count(*) FROM professor WHERE prof_high_degree  =  'Ph.D.'

Question: How many students are enrolled in some classes that are taught by an accounting professor?
SQL: 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'

Question: What is the name of the department with the most students enrolled?
SQL: 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

Question: What are the names of all departments in alphabetical order?
SQL: SELECT dept_name FROM department ORDER BY dept_name

Question: What are the codes of all the courses that are located in room KLR209?
SQL: SELECT class_code FROM CLASS WHERE class_room  =  'KLR209'

Question: What are the first names of all employees that are professors ordered by date of birth?
SQL: SELECT emp_fname FROM employee WHERE emp_jobcode  =  'PROF' ORDER BY emp_dob

Question: What are the first names and office locations for all professors sorted alphabetically by first name?
SQL: 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

Question: What are the first and last names of the employee with the earliest date of birth?
SQL: SELECT emp_fname ,  emp_lname FROM employee ORDER BY emp_dob LIMIT 1

Question: What is the first and last name of the youngest student with a GPA above 3, and what is their GPA?
SQL: SELECT stu_fname ,  stu_lname ,  stu_gpa FROM student WHERE stu_gpa  >  3 ORDER BY stu_dob DESC LIMIT 1

Question: What are the first names of all students who got a grade C in a class?
SQL: SELECT DISTINCT stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num  =  T2.stu_num WHERE enroll_grade  =  'C'

Question: What is the name of the department with the fewest professors?
SQL: 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