Sqlite 1 a Write CREATE TABLE commands to construct a databa

Sqlite 1. a) Write CREATE TABLE commands to construct a database according to the monograph in Figure 1. Remember to specify the correct keys, the correct foreign keys and determine which foreign keys may be null b) Write CREATE TABLE commands to construct a database according to the monograph in Figure 2. Remember to specify the correct keys, the correct foreign keys and determine which foreign keys may be null Figure 1: name address Stars title ear Stars-in Movies name Owns length genre Studios address Figure 2: row seat Bookings toCust toFlt Customers hone Flights SSNo number aircraft addr name

Solution

Answer to Question Number 1a. Figure 1. :-

CREATE TABLE Stars(
name varchar(30) NOT NULL,
address varchar(255),
PRIMARY KEY (name)
);

CREATE TABLE Movies(
title varchar(255) NOT NULL,
year int NOT NULL,
length int,
genre varchar(30),
stars varchar(30) FOREIGN KEY REFERENCES Stars(name),
studio varchar(30) FOREIGN KEY REFERENCES Studios(name),
CONSTRAINT PK_movies PRIMARY KEY (title,year)
);

CREATE TABLE Studios(
name varchar(30) NOT NULL,
address varchar(255),
PRIMARY KEY (name)
);


**Please note : By the Diagram and arrow directions, assuming Stars are present in Movies and Studios are present in Movies.
If any clarifications are required, feel free to drop a comment.


Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site