Question: Construct SQL queries using Oracle for the following questions. 1)How many different departments are there? 2) What is the average salary of professors in each

Construct SQL queries using Oracle for the following questions.

1)How many different departments are there?

2) What is the average salary of professors in each department?

3) List the courses (courseid and coursename) along with the teacher (teachername) teaching it.

4) List the number of courses (how many) taught by each department.

Construct SQL queries using Oracle for the following questions. 1)How many different

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!