Question: question no 1 Given the following db schema: Movies(mid:integer, title:string, director:string, studio:string, releaseyear:integer) Customers(cid:integer,name:string, city: string, state:string, age:real) Watch(cid:integer,mid:integer, watchedon:date) Primary keys are underlined in
question no 1
Given the following db schema: Movies(mid:integer, title:string, director:string, studio:string, releaseyear:integer) Customers(cid:integer,name:string, city: string, state:string, age:real) Watch(cid:integer,mid:integer, watchedon:date) Primary keys are underlined in each relation. A movie is identified by an id (mid). It also has a title, director, studio and releaseyear.A customer is identified by cid. It also has a name, a city, state and age.Customers watch movies. When a customer watches a movie a record is inserted into Watch table, that will contain information about the ids as well as the date on which cid watched mid (attr. watchedon). Notes: For both CS430 and CS630 students, each problem (a through g) carries 4 points possible. For this schema: a) Write the SQL statement to create the table Movies. Do not forget about the key constraints. b) Write the SQL statement to create table Customers. Add the constraint that a customer must be at least 18 years old. Do not forget about the key constraints. c) Write the SQL to create table Watch. Do not forget about the key constraints. d) Write the SQL statement to create an index on column watchedon of table Watch. Name that index indexWatchDate.
Step by Step Solution
3.41 Rating (151 Votes )
There are 3 Steps involved in it
Movies table CREATE TABLE Movies mid INTEGER PRIMARY KEY AUTOINCREMENT title VARCHAR120 NOT NULL director VARCHAR120 NOT NULL studio VARCHAR120 NOT NU... View full answer
Get step-by-step solutions from verified subject matter experts
