Answered step by step
Verified Expert Solution
Link Copied!

Question

...
1 Approved Answer

Specify the following queries in SQL on the database schema of Figure1.2. Retrieve the name of each course and the instructor who taught thatcourse. If

  1. Specify the following queries in SQL on the database schema of Figure 1.2.
    1. Retrieve the name of each course and the instructor who taught that course. If an instructor taught a course more than one time, remove the redundant information.

SELECT Name

FROM STUDENT 

WHERE Major='COSC'

  1. For each section of those courses offered by CS department, retrieve the course number, semester, year, and number of students who took the section.

            SELECT course_name

            FROM COURSE, SECTION

WHERE COURSE.course_number=SECTION.course_number AND Instructor='King' AND (Year='85' OR Year='86')

Another possible SQL query uses nesting as follows:

            SELECT course_name

            FROM COURSE

            WHERE course_number IN (SELECT Course Number FROM SECTION

      WHERE Instructor='King' AND (Year='85' OR Year='86'))

  1. For each student who took more than 2 sections, retrieve the name, student number, major of the student and the number of sections taken by the student.

SELECT course_number, Semester, Year, COUNT (*)

FROM SECTION, GRADE_REPORT

WHERE Instructor='King' AND SECTION.SectionIdentifier=GRADE_REPORT.SectionIdentifier

GROUP BY course_number, Semester, Year

image text in transcribedSTUDENT

image text in transcribedCOURSE

SECTION

GRADE_REPORT

PREREQUISITE

Name Student_number Class Major Smith 17 1 CS Brown 8 2 CS

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Fundamentals of Database Systems

Authors: Ramez Elmasri, Shamkant Navathe

6th edition

978-0136086208

More Books

Students also viewed these Programming questions