This assignment will use the following SQL schema:
create table Location(
id int primary key,
city varchar(255),
state varchar(100),
country varchar(255)
);
create table Person(
id int primary key,
name varchar(100)
);
create table Photographer(
id int primary key references Person(id) on update cascade on delete cascade,
livesIn int not null references Location(id) on update cascade on delete no action
);
create table Specialty(
photographer int references Photographer(id) on update cascade on delete cascade,
type enum('portrait','landscape','sport'),
primary key(photographer, type)
);
create table Photo(
id int primary key,
takenAt timestamp not null,
takenBy int references Photographer(id) on update cascade on delete no action,
photographedAt int references Location(id) on update cascade on delete no action,
type enum('portrait','landscape','sport')
);
create table Appearance(
shows int references Person(id) on update cascade on delete cascade,
isShownIn int references Photo(id) on update cascade on delete cascade,
primary key(shows, isShownIn)
);
| Photographer | Specialty | Number of photos |
|---|---|---|
| Fred | portrait | 120 |
| 254 | ||
| Total | 374 | |
| Mary | sport | 375 |
| Total | 375 |
| Country | State/Province | City | Photographer |
|---|---|---|---|
| Canada | Ottawa | Toronto | Fred |
| Quebec | Montreal | Alice | |
| USA | Massachusetts | Boston | Bob |
Upload your solution to a folder named Assignment9 in your repository. You should have one file named queries.sql for the queries and files named transform1.xsl and transform2.xsl for the XSLT transforms.