The primary key fields are underlined, and the domain of each field is Wsted aft
ID: 3940234 • Letter: T
Question
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.Explanation / Answer
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)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.