Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following relations: Emp(eid: integer, ename: varchar, sal: integer

ID: 3711502 • Letter: C

Question

Consider the following relations:
Emp(eid: integer, ename: varchar, sal: integer, age: integer, did: integer)
Dept(did: integer, budget: integer, floor: integer, mgr_eid: integer)

Salaries range from $10,000 to $100,000, ages vary from 20 to 80, each department has about 5 employees on average, there are 10 floors, and budgets vary from $10,000 to $1M. You can assume uniform distribution. For each of the following queries, which of the listed index choices would you choose to speed up the query? Explain briefly (no more than 3 lines).

Query 1: Print ename, age, and sal for all employees.

Primary (clustered) hash index on (ename, age, sal) fields of Emp.

Secondary (unclustered) hash index on (ename, age, sal) fields of Emp.

Primary B+ tree index on (ename, age, sal) fields of Emp

Secondary hash index on (eid, did) fields of Emp.

No index.

Query 2: Find the dids of departments that are on the 10th floor and have a budget of less than $15,000.

Primary index on the floor field of Dept.

Secondary index on the floor field of Dept.

Primary B+ tree index on (floor, budget) fields of Dept.

Secondary B+ tree index on (floor, budget) fields of Dept.

No index.

Explanation / Answer

If you have any doubts, please give me comment...

--Query 1)
SELECT ename, sal, age
FROM Emp;

--Query 2)
SELECT did
FROM Dept
WHERE floot = 10 AND budget<15000;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote