Question: I need help. I need to create a chart that shows enrollments by department and I have attached my code but instead of giving me

I need help.

I need to create a chart that shows enrollments by department and I have attached my code but instead of giving me enrollments by departments is giving me by college! What do I need to change or how does my code should be!

Thanks

I need help. I need to create a chart that shows enrollments

SELECT DEPARTMENTS.DEPT_NAME, SUM(SECTIONS.ENROLLMENT) AS ENROLLMENT FROM SECTIONS INNER JOIN COURSES ON SECTIONS.COURSE_CODE = COURSES.COURSE_CODE INNER JOIN SUBJECTS ON COURSES.SUBJECT_ID = SUBJECTS.SUBJECT_ID INNER JOIN COLLEGE INNER JOIN DEPARTMENTS ON COLLEGE.COLLEGE_ID = DEPARTMENTS.COLLEGE_ID ON SUBJECTS.COLLEGE_ID = COLLEGE.COLLEGE_ID GROUP BY DEPARTMENTS.DEPT_NAME

SECOND TRY!

SELECT DEPARTMENTS.DEPT_NAME, SUM(SECTIONS.ENROLLMENT) AS ENROLLMENT FROM SUBJECTS INNER JOIN COURSES ON SUBJECTS.SUBJECT_ID = COURSES.SUBJECT_ID INNER JOIN SECTIONS ON COURSES.COURSE_CODE = SECTIONS.COURSE_CODE INNER JOIN COLLEGE ON SUBJECTS.COLLEGE_ID = COLLEGE.COLLEGE_ID INNER JOIN DEPARTMENTS ON COLLEGE.COLLEGE_ID = DEPARTMENTS.COLLEGE_ID GROUP BY DEPARTMENTS.DEPT_NAME

I know I am missing something so obvious I just cannot find what!

DATABASE DIAGRAM SUBJECTS COLLEGE COURSES SUBJECT-ID SUBJECTNAME COLLEGE ID COURSECODE SUBJECT_ID COURSE_NUMBER HOURS COURSE NAME COLLEGE_NAME - COLLEGEID - DEPARTMENTS DEPARTMENT ID DEPT NAME COLLEGE_ID INSTRUCTOR INSTRUCTOR_ID INSTRUCTOR LAST NAME INSTRUCTOR FIRST_NAME INSTRUCTOR_EMAIL DEPARTMENT ID SECTIONS SECTION ENROUIMENT COURSE CODE INSTRUCTOR_ID SEMESTER SECTION YEAR ISBN EBOOKS ISBN PRICE ONLINE LAB PUBLISHER

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!