· 6 years ago · Oct 30, 2019, 07:44 PM
1drop table if exists stars;
2drop table if exists starsin;
3drop table if exists movies;
4drop table if exists owns;
5drop table if exists studios;
6
7create table stars (
8 name char(100) primary key not null,
9 address char(100)
10);
11
12create table starsin (
13 name char(100) not null,
14 title char(100) not null,
15 year int,
16 foreign key(name) references stars(name),
17 foreign key(title) references movies(title)
18);
19
20create table movies (
21 title char(100) primary key not null,
22 year int,
23 length int,
24 genre char(100),
25 studioname char(100)
26);
27
28/*
29 hver mynd getur verid med eitt studio
30 hvert studio getur verid med margar myndir
31*/
32create table studios (
33 name char(100) primary key not null,
34 address char(100),
35 foreign key(name) references movies(studioname)
36);