Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

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

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions