Question: Please write an anonymous PL / SQL program which uses an implicit cursor to print out the score and rank of team 'Mad Scientists' in

Please write an anonymous PL/SQL program which uses an implicit cursor to print out the score and rank of team 'Mad Scientists' in the competition 'Science Olympiad Regional Baltimore'. Please handle exceptions.
create table school
(sid int, -- school id
sname varchar(50),-- school name
primary key(sid));
insert into school values(1, 'Catonsville High');
insert into school values(2, 'MarriottsRidge High');
create table team
(tid int, --- team id
tname varchar(50),--- team name
primary key(tid)
);
insert into team values(1,'Science Genius');
insert into team values(2,'Super robot');
insert into team values(3,'Mad Scientists');
insert into team values(4,'Little Eisenstein');
create table student
(stid int, -- student id
stname varchar(50),--- student name
sid int, --- school id
tid int, --- team id
grade int, --- grade
primary key(stid),
foreign key(sid) references school,
foreign key(tid) references team);
insert into student values(1, 'Anna', 1,1,11);
insert into student values(2, 'Erica', 1,1,12);
insert into student values(3, 'David', 1,1,11);
insert into student values(4, 'Ravi', 1,2,11);
insert into student values(5, 'Ali', 1,2,12);
insert into student values(6, 'Cathy', 1,2,11);
insert into student values(7, 'Grace', 2,3,11);
insert into student values(8, 'Megan', 2,3,12);
insert into student values(9, 'Jeff', 2,3,11);
insert into student values(10, 'Ryan', 2,4,11);
insert into student values(11, 'Ron', 2,4,12);
insert into student values(12, 'Ella', 2,4,11);
create table competition
(cid int, --- competition id
cname varchar(50),--- competition name
cdate date, --- competition date
primary key (cid));
insert into competition values (1, 'Science Olympiad Regional Baltimore',
date '2020-2-28');
insert into competition values (2, 'Science Olympiad Maryland State',
date '2020-4-1');
create table team_result
(tid int, --- team id
cid int, --- competition id
score number, --- score of the team in the competition
rank int, --- teams ranking in the competition, smaller the better
primary key(tid,cid),
foreign key(tid) references team,
foreign key(cid) references competition);
insert into team_result values(1,1,95,2);
insert into team_result values(2,1,90,3);
insert into team_result values(3,1,89,4);
insert into team_result values(4,1,99,1);
insert into team_result values(1,2,98,2);
insert into team_result values(4,2,100,1);

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!