Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

All queries in this question are based on the sample schema shown below. Assume that the tables have many more rows than are shown there.

All queries in this question are based on the sample schema shown below. Assume that the tables have many more rows than are shown there.
There are six tables describing employees, departments, buildings, department(s) in which an employee works (and a percentage of the time for each), department managers (possibly more than one per department), and building(s) in which an employee works (an employee may have more than one office). The primary key of each table is the attribute or attributes in capital letters. The database in which these tables are stored supports hash indexes, B+ tree indexes, and ISAM indexes. Multi-attribute indexes are defined in the order that matches the column order. The primary key index for a table is a clustered hash index on the primary key attribute(s). EMP, BUILDING AND DEPT all have unclustered B+ tree indexes on their name attributes.
2.4 What value will the following SQL query produce if run against our sample data?
SELECT COUNT(DISTINCT salary)
FROM EMP
WHERE salary 95000 AND
(start_date >'3/1/93' OR start_date ='3/1/93');
2.5 Consider running the following query against the sample data. What will Johns rank field value be?
SELECT DENSE_RANK() OVER (ORDER BY salary ASC) AS rank, *
FROM EMP
WHERE start_date IS NOT NULL
ORDER BY rank;
2.6 Consider running the following query against the sample data. How many rows will the query produce that have Field' in one or more of their columns?
SELECT division, name, sum(budget)
FROM DEPT D
GROUP BY ROLLUP(division,name)
ORDER BY division, name;
2.7 Now consider that this company creates a snapshot of the EMP table for every decade called EMP followed by the decade name (e.g. EMP2010, EMP2020, etc.) to maintain an historical record of its employees that can be used for reporting and OLAP queries. Once the tables are successfully created, they are never updated again. Almost of the queries used for reporting will involved various range predicates on salary. These new tables need not use the same indexing strategy as the EMP table itself. What would be the most efficient choice for indexing the salary column on the decade tables (e.g., EMP2010, EMP2020, etc.)?
Choice 1 of 5:Unclustered B+ Tree index on salary
Choice 2 of 5:Clustered Hash index on salary
Choice 3 of 5:Clustered ISAM index on salary
Choice 4 of 5:The decade tables should have exactly the same indexes as the EMP table.
Choice 5 of 5:No indexes will be needed for the decade tables.EID values range from 1 to 100,000
BUILDING -2,000 tuples, 1pages
BID values range from 1 to 500
DEPT -1,000 tuples, 5 pages
DID values range from 1 to 2000
IN_DEPT -110,000 tuples, 550 pages
IN_BUILDING -110.000 tuples, 550 pages
MANAGES_DEPT -800 tuples, 4 pages
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

What is effective capacity?

Answered: 1 week ago

Question

Why are positive stereotypes harmful?

Answered: 1 week ago

Question

Summarise the scope of HRM and the key HRM functions

Answered: 1 week ago