Database: college_3

Question: Count the number of courses.
SQL: SELECT count(*) FROM COURSE

Question: Count the number of courses with more than 2 credits.
SQL: SELECT count(*) FROM COURSE WHERE Credits  >  2

Question: What are the names of courses with 1 credit?
SQL: SELECT CName FROM COURSE WHERE Credits  =  1

Question: What are the course names for courses taught on MTW?
SQL: SELECT CName FROM COURSE WHERE Days  =  "MTW"

Question: How many departments are in the division AS?
SQL: SELECT count(*) FROM DEPARTMENT WHERE Division  =  "AS"

Question: Give the phones for departments in room 268.
SQL: SELECT DPhone FROM DEPARTMENT WHERE Room  =  268

Question: How many students have had at least one "B" grade?
SQL: SELECT COUNT(DISTINCT StuID) FROM ENROLLED_IN WHERE Grade  =  "B"

Question: What are the maximum and minumum grade points?
SQL: SELECT max(gradepoint) ,  min(gradepoint) FROM GRADECONVERSION

Question: What are the first names for students who have an "a" in their first name?
SQL: SELECT DISTINCT Fname FROM STUDENT WHERE Fname LIKE '%a%'

Question: What are the full names of faculties with sex M and who live in building NEB?
SQL: SELECT Fname ,  Lname FROM FACULTY WHERE sex  =  "M" AND Building  =  "NEB"

Question: What are the rooms for members of the faculty who are professors and who live in building NEB?
SQL: SELECT Room FROM FACULTY WHERE Rank  =  "Professor" AND Building  =  "NEB"

Question: What is the name of the department in the Building Mergenthaler?
SQL: SELECT DName FROM DEPARTMENT WHERE Building  =  "Mergenthaler"

Question: What is all the information about courses, ordered by credits ascending?
SQL: SELECT * FROM COURSE ORDER BY Credits

Question: What are the course names, ordered by credits?
SQL: SELECT CName FROM COURSE ORDER BY Credits

Question: What are the first names of students, ordered by age from greatest to least?
SQL: SELECT Fname FROM STUDENT ORDER BY Age DESC

Question: What are the last names of female students, ordered by age descending?
SQL: SELECT LName FROM STUDENT WHERE Sex  =  "F" ORDER BY Age DESC

Question: What are the last names of faculty in building Barton, sorted by last name?
SQL: SELECT Lname FROM FACULTY WHERE Building  =  "Barton" ORDER BY Lname

Question: What are the first names for all faculty professors, ordered by first name?
SQL: SELECT Fname FROM FACULTY WHERE Rank  =  "Professor" ORDER BY Fname

Question: What is the name of the department with the most students minoring in it?
SQL: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO  =  T2.DNO GROUP BY T2.DNO ORDER BY count(*) DESC LIMIT 1

Question: What is the name of the department htat has no students minoring in it?
SQL: SELECT DName FROM DEPARTMENT EXCEPT SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO  =  T2.DNO

Question: What is the name of the department with the fewest members?
SQL: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO  =  T2.DNO GROUP BY T2.DNO ORDER BY count(*) ASC LIMIT 1

Question: What is the least common faculty rank?
SQL: SELECT Rank FROM FACULTY GROUP BY Rank ORDER BY count(*) ASC LIMIT 1