human
Schema:
Campuses (Id, Campus, Location, County, Year)
csu_fees (Campus, Year, CampusFee)
degrees (Year, Campus, Degrees)
discipline_enrollments (Campus, Discipline, Year, Undergraduate, Graduate)
enrollments (Campus, Year, TotalEnrollment_AY, FTE_AY)
faculty (Campus, Year, Faculty)
Please answer with SQL.
assistant
Sure, I understand.
human
Please tell me the number of undergraduates from each campus in the year 2004
assistant
SELECT t2.campus , SUM( t1.graduate ) FROM discipline_enrollments AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t1.year = 2004 GROUP by t2.Campus;
human
please show the undergrads total from each campus
assistant
SELECT t2.campus , SUM( t1.undergraduate ) FROM discipline_enrollments AS t1 JOIN campuses AS t2 ON t1.campus = t2.id GROUP by t2.Campus;
human
now please show just the total of graduates from San Francisco State University in 2004
assistant
SELECT SUM( t1.graduate ) FROM discipline_enrollments AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t1.year = 2004 AND t2.campus = "San Francisco State University" ;