Exercise 831 For our running movies example Moviestitle year
Exercise 8.3.1: For our running movies example:
Movies(title, year, length, genre, studioNarne, producerC#)
Starsin(movieTitle, movieYear, starNarne) \' MovieExec(narne, address, cert#, netWorth)
Studio(narne, address, presC#)
Declare indexes on the following attributes or combination of attributes:
. a) studioNarne.
b) address of MovieExec.
c) genre and length.
Solution
For creating the indexes using sql, following are the sql statements:
a) studioNarne
CREATE INDEX studioNarne_index
ON Movies(studioNarne);
This will create an index named \"studioNarne_index\" on the \"studioNarne\" column in the \"Movies\" table.
b) address of MovieExec
CREATE INDEX address_index
ON MovieExec(address);
This will create an index named \"address_index\" on the \"address\" column in the \"MovieExec\" table.
c) genre and length - combination of 2 columns
CREATE INDEX comb_index
ON Movies (genre , length );
This will create an index named \"comb_index\" on on a combination of columns(genre , length) in the \"Movies\" table. Similalry we can pass as many columns as we want in the parantheses seperated by commas.
