Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer! will upvote Given here is a SQL script create table course( cid varchar(10), name varchar(50), prof integer ); create table student( gid integer,

Please answer! will upvote

Given here is a SQL script

create table course( cid varchar(10), name varchar(50), prof integer ); create table student( gid integer, fname varchar(25), lname varchar(25), age integer, gpa number(2,1), adviser integer); create table professor( pid integer, fname varchar(25), lname varchar(25) ); create table studied( student integer, class varchar(10), hours integer); alter table professor add primary KEY (pid); alter table course add FOREIGN KEY (prof) references professor(pid); alter table course add primary key (cid); alter table student add primary key (gid); Alter table student add foreign key (adviser) references professor(pid); alter table studied add primary key (student,class); alter table studied add foreign key (student) references student(gid); alter table studied add foreign key (class) references course(cid); insert into professor values (11,'June','Bauer'); insert into professor values (91,'Ian','Dunacan'); insert into professor values (37,'Brittany','Baker'); insert into professor values (21,'Noel','Cornwallis'); insert into professor values (53,'Ben','Chang'); insert into professor values (42,'Professor','Professorson'); insert into professor values (44,'Marshall','Kane'); insert into professor values (18,'Jason','Chapman'); insert into course values ('SP 101', 'Spanish 101',53); insert into course values ('AN 101', 'Anthropology 101',11); insert into course values ('HI 199', 'History of History',21); insert into course values ('BO 101', 'Biology 101',44); insert into course values ('MT NaN', 'Math 1-2-4',37); insert into course values ('BS 101', 'Studyology',91); insert into course values ('PE 137', 'Theoretical Phys Ed',18); insert into course values ('HI 243', 'Conspiracy Thories',42); insert into student values (871, 'Jeff','Winger',42,2.6,42); insert into student values (542, 'Britta','Perry',31,2.8,91); insert into student values (681, 'Abed','Nadir',35,3.6,21); insert into student values (667, 'Shirley','Bennett',43,4.0,53); insert into student values (753, 'Annie','Edison',31,4.0,18); insert into student values (755, 'Troy','Barnes',31,3.3,37); insert into student values (101, 'Pierce','Hawthorne',70,0.7,11); insert into student values (921, 'Ben','Chang',45,2.8,53); insert into studied values(871,'SP 101',2); insert into studied values(542,'AN 101',2); insert into studied values(667,'HI 199',10); insert into studied values(101,'BS 101',1); insert into studied values(542,'BO 101',5); insert into studied values(753,'HI 199',12); insert into studied values(681,'HI 199',2); insert into studied values(755,'HI 199',8); insert into studied values(681,'BO 101',8); insert into studied values(667,'AN 101',7); insert into studied values(871,'HI 199',1); insert into studied values(753,'BO 101',20); insert into studied values(101,'PE 137',NULL); insert into studied values(921,'SP 101',5); insert into studied values(753,'AN 101',18);

Use the script to implement the database in your individual Oracle account or Oracle live.

Then, implement the queries to retrieve the required information to answer the following questions: you must submit all the queries you have written in question 5 to get points for 1-4

1)What are the last names of students in BO 101?

Group of answer choices:

Perry, Nadir, Edison

Winger, Nadir, Edison

Perry, Nadir, Chang

Perry, Edison

2)What are the last names of students except those in BO 101?

Group of answer choices:

Hawthorne, Bennett, Barnes, Winger, Chang

Hawthorne, Bennett, Barnes, Chang

Hawthorne, Edison, Barnes, Winger, Chang

Hawthorne, Bennett, Nadir, Winger, Chang

3)What are the last names of students in HI 199 or HI 243?

Bennett, Nadir, Edison, Barnes, Winger

Bennett, Nadir, Edison, Chang, Winger

Bennett, Nadir, Barnes, Winger

Bennett, Nadir, Edison, Winger

Group of answer choices:

4)What is the number of professors who teach more than 3 courses?

Group of answer choices: 0, 2, 1, 3

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

Students also viewed these Databases questions