The primary key fields are underlined and the domain of each

The primary key fields are underlined, and the domain of each field is Wsted after the field name. Thus aID is the key for Actors, mID is the key for Movies, dID is the key for Directors, (aID, mID, role) forms the key for Casts, (dID, mID) forms the key for MovieDirectors, and (mID, genre)forms the key for Genres. Write CREATE INDEX statements that would help speeding up the following queries. SELECT name, mYear FROM Movies WHERE rating >= 9; Build an index on attribute rating on the Movies table. Provide the SQL statement. SELECT fName, 1Name FROM Actors WHERE gender = \'F\'; Build an index on attributes gender on the Actors table. Provide the SQL statement. SELECT name FROM Movies WHERE rating >8 AND mYear > \'2010\'; Build an index on attributes rating and mYear on the Movies table. Provide the SQL statement.

Solution

Answer1.

CREATE INDEX movie_rating_index
ON Movies (rating)

Answer2.

CREATE INDEX actor_gender_index
ON Actors (gender)

Answer3.

CREATE INDEX movie_rating_and_myear_index
ON Movies (rating,mYear)

 The primary key fields are underlined, and the domain of each field is Wsted after the field name. Thus aID is the key for Actors, mID is the key for Movies, d

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site