Hello, I need help with the next exercise of SQL. Concept Question 1- Index Plac
ID: 3712255 • Letter: H
Question
Hello, I need help with the next exercise of SQL.
Concept Question 1- Index Placement Consider the following ERD in Figure 1 ITEM RENTAL TAPE FK1 CUS NUM FK2 TAPE CODE CUS UNAME TAPE COPY TAPE NAME TAPE CHARGE RENT DATE OUT RENT COPY RENT CHG DAY RENT DATE RETURN RENT CHARGE Figure 1 Also, assume the following query is frequently run... SELECT CUS NUM, RENT NUM FROM ITEM JOIN RENTAL ON ITEM.CUS NUM = RENTAL. CUSNUM WHERE CUS LNAME = 'SMITH' - ept Ouesti Specify where indexes should be placed and if the index should be a unique or non-unique index. Explain your responseExplanation / Answer
Index can be used for easy retreaval of output. Generally we can cretae index on table. DB used that index for searching. Usually Index contains keys, which are tajken based on one or more columns from the table in SQL. And the keys are stored in a seperate structure which is going to enable by SQL seerver .
An index can be used when there is a chance of containing a column which is having several values and one or more columns can be combined used in where clause or join condition.
Here our query contains
Select cus_num, rent_num from item join rental on item. cus_num = rental.cus_num where cus_lname='SMITH'
Here cus_num and rent_num are two primary keys, which are logical objects but index is a physical object.
Here incondition we are searching for cus_lname, so craeting unique index at cus_lname. So it directly fetch the records related to cus_lname index, instead of searching all the fields in the table.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.