drop table teams cascade constraints;
create table teams (
  tname varchar2(20),
  primary key (tname)
);
insert into teams values ('Braves');
insert into teams values ('Cardinals');
insert into teams values ('Cubs');
insert into teams values ('Diamondbacks');
insert into teams values ('Indians');
insert into teams values ('Red Sox');
insert into teams values ('Reds');
insert into teams values ('Rockies');
--
drop table results cascade constraints;
create table results (
  when date, -- includes time of game as well
  home varchar2(20),
  visitor varchar2(20),
  hruns number(3),
  vruns number(3),
  primary key (when,home),
  foreign key (home) references teams,
  foreign key (visitor) references teams
);
--
insert into results values ('20-MAR-2004','Rockies','Braves',10,6);
insert into results values ('20-MAR-2004','Reds','Cardinals',16,1);
insert into results values ('20-MAR-2004','Indians','Red Sox',1,0);
insert into results values ('20-MAR-2004','Diamondbacks','Cubs',10,11);
--
insert into results values ('23-MAR-2004','Braves','Cardinals',0,1);
insert into results values ('23-MAR-2004','Rockies','Indians',10,14);
insert into results values ('25-MAR-2004','Red Sox','Diamondbacks',1,0);
insert into results values ('25-MAR-2004','Cubs','Reds',10,12);
insert into results values ('27-MAR-2004','Cardinals','Cubs',7,9);
insert into results values ('27-MAR-2004','Indians','Braves',1,0);
insert into results values ('27-MAR-2004','Diamondbacks','Rockies',15,5);
insert into results values ('27-MAR-2004','Reds','Red Sox',7,6);
--
insert into results values ('30-MAR-2004','Red Sox','Cardinals',0,1);
insert into results values ('30-MAR-2004','Braves','Cubs',10,5);
insert into results values ('01-APR-2004','Indians','Diamondbacks',8,8);
insert into results values ('01-APR-2004','Rockies','Reds',3,10);
--
insert into results values ('15-APR-2004','Cubs','Red Sox',0,1);
insert into results values ('15-APR-2004','Diamondbacks','Braves',3,11);
insert into results values ('16-APR-2004','Reds','Indians',11,5);
insert into results values ('17-APR-2004','Diamondbacks','Reds',7,15);
insert into results values ('17-APR-2004','Braves','Red Sox',9,4);
insert into results values ('17-APR-2004','Cubs','Rockies',10,10);
insert into results values ('17-APR-2004','Indians','Cardinals',7,11);
--
insert into results values ('20-APR-2004','Cardinals','Diamondbacks',10,12);
insert into results values ('20-APR-2004','Red Sox','Rockies',4,1);
insert into results values ('22-APR-2004','Reds','Braves',5,6);
insert into results values ('22-APR-2004','Cubs','Indians',7,4);
insert into results values ('23-APR-2004','Cardinals','Rockies',5,4);
insert into results values ('24-APR-2004','Red Sox','Indians',10,5);
insert into results values ('24-APR-2004','Cardinals','Reds',3,13);
insert into results values ('24-APR-2004','Braves','Rockies',9,8);
insert into results values ('24-APR-2004','Cubs','Diamondbacks',7,12);
--
insert into results values ('27-APR-2004','Reds','Cubs',13,3);
insert into results values ('27-APR-2004','Diamondbacks','Red Sox',12,11);
insert into results values ('29-APR-2004','Indians','Rockies',7,12);
insert into results values ('29-APR-2004','Cardinals','Braves',2,10);
--
insert into results values ('01-MAY-2004','Braves','Indians',14,14);
insert into results values ('01-MAY-2004','Cubs','Cardinals',10,0);
insert into results values ('01-MAY-2004','Rockies','Diamondbacks',8,7);
insert into results values ('01-MAY-2004','Red Sox','Reds',0,16);
--
insert into results values ('04-MAY-2004','Cubs','Braves',10,8);
insert into results values ('04-MAY-2004','Diamondbacks','Indians',8,7);
insert into results values ('06-MAY-2004','Cardinals','Red Sox',5,5);
insert into results values ('06-MAY-2004','Reds','Rockies',8,2);
--
insert into results values ('08-MAY-2004','Rockies','Cardinals',10,6);
insert into results values ('08-MAY-2004','Red Sox','Cubs',10,12);
insert into results values ('08-MAY-2004','Indians','Reds',4,15);
insert into results values ('08-MAY-2004','Braves','Diamondbacks',6,8);
--
insert into results values ('11-MAY-2004','Reds','Diamondbacks',13,12);
insert into results values ('11-MAY-2004','Red Sox','Braves',0,4);
insert into results values ('13-MAY-2004','Cubs','Rockies',9,8);
insert into results values ('13-MAY-2004','Cardinals','Indians',3,6);
--
insert into results values ('15-MAY-2004','Braves','Reds',12,11);
insert into results values ('15-MAY-2004','Rockies','Red Sox',7,16);
insert into results values ('15-MAY-2004','Diamondbacks','Cardinals',7,13);
insert into results values ('15-MAY-2004','Indians','Cubs',6,8);
--
insert into results values ('18-MAY-2004','Diamondbacks','Cubs',13,5);
insert into results values ('18-MAY-2004','Reds','Cardinals',6,5);
insert into results values ('20-MAY-2004','Braves','Rockies',8,7);
insert into results values ('20-MAY-2004','Red Sox','Indians',10,11);
--
insert into results values ('22-MAY-2004','Red Sox','Diamondbacks',7,12);
insert into results values ('22-MAY-2004','Braves','Cardinals',3,6);
insert into results values ('22-MAY-2004','Reds','Cubs',1,0);
insert into results values ('22-MAY-2004','Rockies','Indians',0,1);
--
