(D-Problems discussed on Friday, 30-Sep-2016)
(Q-Problems due on Tuesday, 04-Oct-2016)
T7-PP1: (SQL Query) Read Chapter 13.3 (pp 598-606) of [SG3].
T7-PP2: (SQL Query) Problems 1, 2, 3 on page 606 (Chapter 13) of [SG3].
T7-PP3: (SQL Query) Problems 4, 5 on page 617 (Chapter 13) of [SG3].
T7-D1: (SQL Query)
Problems 6 on page 617 (Ch. 13) of [SG].
(Note: First read Ch.13.3 of [SG3] to learn about SQL.)
T7-D2: (Efficient Query Processing) -- given in next page.
T7-D3: (Question from a former Quiz) --
Question Q4 from
[Spring-2013 MidTerm-Q4].
(Ignore Q4(a)(ii) and Q4(b)(ii) on use of basic database primitives.)
Problems to be Handed in for Grading by the Deadline:
(Note: Please submit hard copy to me.
Not just soft copy via email.)
T7-Q1: (10 points) (SQL Query)
[Modified from Problems 7, p625, Ch 13 of [SG].]
(a) Using the Employees table of Figure 13.6 and the
InsurancePolicies table of Figure 13.7, write an SQL
query that retrieves
ID, FirstName, LastName, PlanType, DataIssued for all employees
have pay rate of more than $10.00.
(b)
Suppose we use the JOIN operation on Employees and InsurancePolicies
to process this SQL query; similar to that given in the lecture notes (2016-04a-SQL-anim.ppt, Query Q3).
How many row operations are needed to process this SQL query?
(c) Show the output table produced by this SQL query. How many rows are there in this table?
T7-Q2: (20 points) (Efficient Query Processing) -- given in next page.
A6-2016: (Really LARGE numbers -- how to deal with them!)
Some entries in the table for T5-Q4 cause overflow in Excel/calculators --
and are listed as "too big to compute".
(Example, for T(n)=2n,
when n=1000, the running time is 3.40 x 10291 yrs.)
Explore creative way to compute these very big numbers with
the help of calculators.
(Hint: John Napier, 1614)
SELECT Name, Faculty, Course-ID FROM SI, EN WHERE (Student-ID='U2908888P') and (SI.Student-ID = EN.Student-ID)
(b) Give an "SQL query" statement to obtain each of the following:
(c)
How many row operations are needed to process each of the SQL queries given above?
(Note: You will need to estimate of the size of the intermediate table for (iii).)
(a) Give a "concise English description" of the output of the following SQL query:
SELECT Course-ID, Name, Instructor FROM CI, EN WHERE (Student-ID='U2908888P') and (CI.Course-ID = EN.Course-ID)
(b) Give an "SQL query" statement to obtain each of the following:
(c)
How many row operations are needed to process each of the SQL queries given above?
(Note: You will need to estimate of the size of the intermediate table for (iii).)