Topic: Database Software: SQLite Schema Table:   CREATE TABLE name_basics (nconst VARCHAR(45) NOT NULL, primaryName VARCHAR(45) NULL, birthYear YEAR(4) NULL, deathYear YEAR(4) NULL, age INT NULL, movieNum INT NULL, PRIMARY KEY (nconst));   CREATE TABLE attributes ( attributeID INT NOT NULL, attribute VARCHAR(45) NOT NULL, PRIMARY KEY (attributeID) ); CREATE TABLE attributes_collection ( akasID INT NOT NULL, attributeID INT NOT NULL, PRIMARY KEY (akasID, attributeID), CONSTRAINT attributeID FOREIGN KEY (attributeID) REFERENCES attributes (attributeID) ON DELETE NO ACTION ON UPDATE NO ACTION); CREATE TABLE crew_directors ( crewID INT NOT NULL, nconst VARCHAR(45) NOT NULL, PRIMARY KEY (crewID, nconst), CONSTRAINT crewID FOREIGN KEY (crewID) REFERENCES title_crew (crewID) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT nconst FOREIGN KEY (nconst) REFERENCES name_basics (nconst) ON DELETE NO ACTION ON UPDATE NO ACTION); CREATE TABLE crew_writers ( crewID INT NOT NULL, nconst VARCHAR(45) NOT NULL, PRIMARY KEY (crewID, nconst), CONSTRAINT crewID FOREIGN KEY (crewID) REFERENCES title_crew (crewID) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT nconst FOREIGN KEY (nconst) REFERENCES name_basics (nconst) ON DELETE NO ACTION ON UPDATE NO ACTION); CREATE TABLE genre ( genreID INT NOT NULL, genre VARCHAR(45) NOT NULL, PRIMARY KEY (genreID)); CREATE TABLE genre_collection ( tconst VARCHAR(45) NOT NULL, genre INT NOT NULL,

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter4: Constraints
Section: Chapter Questions
Problem 11MC: In the initial creation of a table, if a UNIQUE constraint is included for a composite column that...
icon
Related questions
Question

Topic: Database

Software: SQLite

Schema Table:

 

CREATE TABLE name_basics (nconst VARCHAR(45) NOT NULL, primaryName VARCHAR(45) NULL, birthYear YEAR(4) NULL, deathYear YEAR(4) NULL, age INT NULL, movieNum INT NULL, PRIMARY KEY (nconst));

 

CREATE TABLE attributes (
attributeID INT NOT NULL,
attribute VARCHAR(45) NOT NULL,
PRIMARY KEY (attributeID)
);


CREATE TABLE attributes_collection (
akasID INT NOT NULL,
attributeID INT NOT NULL,
PRIMARY KEY (akasID, attributeID),
CONSTRAINT attributeID
FOREIGN KEY (attributeID)
REFERENCES attributes (attributeID)
ON DELETE NO ACTION
ON UPDATE NO ACTION);


CREATE TABLE crew_directors (
crewID INT NOT NULL,
nconst VARCHAR(45) NOT NULL,
PRIMARY KEY (crewID, nconst),
CONSTRAINT crewID
FOREIGN KEY (crewID)
REFERENCES title_crew (crewID)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT nconst
FOREIGN KEY (nconst)
REFERENCES name_basics (nconst)
ON DELETE NO ACTION
ON UPDATE NO ACTION);


CREATE TABLE crew_writers (
crewID INT NOT NULL,
nconst VARCHAR(45) NOT NULL,
PRIMARY KEY (crewID, nconst),
CONSTRAINT crewID
FOREIGN KEY (crewID)
REFERENCES title_crew (crewID)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT nconst
FOREIGN KEY (nconst)
REFERENCES name_basics (nconst)
ON DELETE NO ACTION
ON UPDATE NO ACTION);


CREATE TABLE genre (
genreID INT NOT NULL,
genre VARCHAR(45) NOT NULL,
PRIMARY KEY (genreID));


CREATE TABLE genre_collection (
tconst VARCHAR(45) NOT NULL,
genre INT NOT NULL,
PRIMARY KEY (tconst, genre),
CONSTRAINT genre
FOREIGN KEY (genre)
REFERENCES genre (genreID)
ON DELETE NO ACTION
ON UPDATE NO ACTION);


CREATE TABLE known_collection (
tconst VARCHAR(45) NOT NULL,
nconst VARCHAR(45) NOT NULL,
PRIMARY KEY (tconst, nconst),
CONSTRAINT tconst
FOREIGN KEY (tconst)
REFERENCES title_basics (tconst)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT nconst
FOREIGN KEY (nconst)
REFERENCES name_basics (nconst)
ON DELETE NO ACTION
ON UPDATE NO ACTION);

Prompt: Add triggers to the above schema table that automatically updated when new data in inserted.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
SQL Query
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage