Question
Student.dept indicates the departments of the students, Enroll.grade represents the GPA, Course.dept contains just the departmental acronym, e.g., CSE, indicating the departments that offer the
Student.dept indicates the departments of the students, Enroll.grade represents the GPA, Course.dept contains just the departmental acronym, e.g., CSE, indicating the departments that offer the courses, write following SQL queries
Question - For every department, list the department name and the total number of courses such that more than half of the students enrolled in such a course are from outside of the department that offers the course.
CREATE TABLE student(
sno varchar(10) PRIMARY KEY,
name varchar(20),
dept varchar(10));
CREATE TABLE course(
cno varchar(5) PRIMARY KEY,
dept varchar(10));
CREATE TABLE enroll(
cno varchar(5) REFERENCES course(cno),
sno varchar(10) REFERENCES student(sno),
grade numeric(3,2),
PRIMARY KEY (cno, sno));
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started