Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions