Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions