Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Construct SQL queries using Oracle for the following questions. 1) List the number of courses (how many) taught by each teacher (teacherid is enough no

Construct SQL queries using Oracle for the following questions.

1) List the number of courses (how many) taught by each teacher (teacherid is enough no name needed).

2) Now, list the teacherID, teacherName along with the number of courses taught by each teacher. (Use a Nested SELECT if possbile for this question)

3) List the teacher name, teacher ID, and courses that contain the word Management

4) List all the courses taught by the professors who draw greater than the average salary. Include the courseId, courseName, teahcerID, teacherId, teacherName, salary in your listing.

image text in transcribed

The code for creating the tables is provided below:

CREATE TABLE r_professors(TeacherID CHAR(2) PRIMARY KEY,

TeacherName VARCHAR2(25),

Salary NUMBER(10,2),

DeptID CHAR(2));

INSERT INTO r_professors VALUES ('11','R',66000,'01'); INSERT INTO r_professors VALUES ('12','Hackbarth',65000,'01');

INSERT INTO r_professors VALUES ('13','Frank Braun',67000,'01');

INSERT INTO r_professors VALUES ('14','John Maddoc',58000,'02');

INSERT INTO r_professors VALUES ('15',' Brandi Neal ',68000,'03');

CREATE TABLE r_courses (CourseID CHAR(6) PRIMARY KEY,

CourseName VARCHAR2(25), TeacherID CHAR(2) REFERENCES r_professors(TeacherID));

INSERT INTO r_courses VALUES ('INF282','Database','11');

INSERT INTO r_courses VALUES ('MBI677',ABAP','11');

INSERT INTO r_courses VALUES ('MBI650','Project Management','12');

INSERT INTO r_courses VALUES ('MBI665','Knowledge Management','13');

INSERT INTO r_courses VALUES ('BUS610','Law and Public Policy','14');

INSERT INTO r_courses VALUES ('BUS330','Ethics','14');

INSERT INTO r_courses VALUES ('INF382','IT Security','13');

INSERT INTO r_courses VALUES ('INF480','Systems Analysis','12');

INSERT INTO r_courses VALUES ('INF420','Web Development','15');

CourseID Course Name Teacher ID 282 Database 11 MB1677 ABAP 11 12 MB1650 Project Management MBI665 Knowledge Management 13 BUS610 Law & Public Policy 14 BUS330 ethics 14 INF382 IT Security 12 INF480 Systems Analysis INF420 Web Development 15 Professors Teacher ID TeacherName Salary DeptID 11 Raghavan 66000 01 12 Hackbarth 65000 01 13 Frank Braun 67000 01 14 John Maddoc 58000 02 15 Brandi Neal 68000 03

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

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions