Leave Blank
Leave Blank
Leave Blank
LOC_ID INT NOT NULL); CREATE TABLE RAT ( RAT_ID INT NOT NULL, EMP_ID INT NOT NULL, RAT NUMBER(10,2)); CREATE TABLE LOC ( LOC_ID INT NOT NULL, CODE CHAR(2), DESCRIPTION VARCHAR (256)); CREATE TABLE DEPT ( DEPT_ID INT NOT NULL, CODE VARCHAR(10), DESCRIPTION VARCHAR(256)); CREATE UNIQUE INDEX EMP__EMP_ID__IDX ON EMP(EMP_ID); CREATE UNIQUE INDEX RAT__EMP_ID__IDX ON RAT(EMP_ID); CREATE UNIQUE INDEX RAT__RAT_ID__IDX ON RAT(RAT_ID); CREATE UNIQUE INDEX LOC__LOC_ID__IDX ON LOC(LOC_ID); CREATE UNIQUE INDEX DEPT__DEPT_ID__IDX ON DEPT(DEPT_ID); Assuming very large data sets for each table defined above, which query is likely to run fastest?
SELECT E.name FROM EMP E INNER JOIN DEPT D ON D.dept_id = E.dept_id WHERE E.emp_id = 11; SELECT E.name FROM EMP E INNER JOIN LOC L ON L.loc_id = E.loc_id WHERE E.emp_id = 11; SELECT E.name FROM EMP E INNER JOIN DEPT D ON D.dept_id = E.dept_id INNER JOIN LOC L ON L.loc_id = E.loc_id WHERE E.emp_id = 11; SELECT E.name FROM EMP E INNER JOIN LOC L ON L.loc_id = E.loc_id WHERE E.emp_id = 1; SELECT E.name FROM EMP E INNER JOIN RAT R ON R.emp_id = E.emp_id WHERE E.emp_id = 1; Leave blank
Table
called
Employees
with
following
table has following Indexes created on it Clustered Index on EmployeeID Non Clustered Index on EmployeeName Non Clustered Index on DeptID
The Employees tables has over 10 million rows. You want to get the count of Employees, for which you write the following query SELECT COUNT(*) FROM Employees
What will be the likely query plan for above query? Which index will SQL SERVER use in above query? Please give an explanation for your answer.