DB HW#2 - FROM League L, Coach C, Person P, Team T WHERE...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Part 1 Create table Company( name char(50) primary key, city char(50) not null) Create table Person( id int primary key, name char(80) not null, affiliatedWith char(80) references Company) Create table Book ( id int primary key, title char(150) not null, date Date not null, edition char(40), publishedBy char(80) not null references Company) Create table author( author int references Person, book int references Book, primary key(author, book)) Alter table Book add foreign key(id) references author(book) Part 2 1. SELECT P.name, P.nickname FROM League L, Person P, Team T WHERE T.league=L.id and P.member=T.title and L.name='Cape Cod' ORDER BY P.name 2. SELECT T.title, L.name
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: FROM League L, Coach C, Person P, Team T WHERE T.league=L.id and C.team=T.title and C.coach=P.id and P.name='George' 3. SELECT L.name, T.title, H.coach=C.coach FROM Person P, League L, HeadCoach H, Team T, Coach C WHERE T.league=L.id and C.team=T.title and H.team=T.title and C.coach=P.i and P.name='George' 4. SELECT P.nickname, P.name FROM Team T, League L, Person P WHERE T.league=L.id and P.member=T.title and P.birthdate <= ALL ( SELECT B.birthdate FROM Person B WHERE B.member=T.title) 5. INSERT into League(id, name, level) values (42, 'Far West', 'A') 6. DELETE from League WHERE name='Far West'...
View Full Document

This note was uploaded on 04/08/2008 for the course CS 430 taught by Professor Baclawski during the Spring '08 term at Northeastern.

Page1 / 2

DB HW#2 - FROM League L, Coach C, Person P, Team T WHERE...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online