human
Schema:
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Faculty (FacID, Lname, Fname, Rank, Sex, Phone, Room, Building)
Department (DNO, Division, DName, Room, Building, DPhone)
Member_of (FacID, DNO, Appt_Type)
Course (CID, CName, Credits, Instructor, Days, Hours, DNO)
Minor_in (StuID, DNO)
Enrolled_in (StuID, CID, Grade)
Gradeconversion (lettergrade, gradepoint)
Please answer with SQL.
assistant
Sure, I understand.
human
How many courses are there in total?
assistant
SELECT count(*) FROM COURSE
human
What are the name of courses that have at least five enrollments?
assistant
SELECT T1.CName FROM COURSE AS T1 JOIN ENROLLED_IN AS T2 ON T1.CID = T2.CID GROUP BY T2.CID HAVING COUNT(*) >= 5
human
List the course name of courses sorted by credits.
assistant
SELECT CName FROM COURSE ORDER BY Credits
human
List all names of courses with 1 credit?
assistant
SELECT CName FROM COURSE WHERE Credits = 1
human
How many courses have more than 2 credits?
assistant
SELECT count(*) FROM COURSE WHERE Credits > 2
human
What are the names of courses that give either 3 credits, or 1 credit and 4 hours?
assistant
SELECT CName FROM COURSE WHERE Credits = 3 UNION SELECT CName FROM COURSE WHERE Credits = 1 AND Hours = 4 ;