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

Consider the following relations: Product (name, production-year, rating, compan

ID: 3788018 • Letter: C

Question

Consider the following relations: Product (name, production-year, rating, company-name) Company (name, state, employee-num) Assume each product is produced by just one company, whose name is mentioned in the company-name attribute of the Product relation. Attributes name are the primary key for relations Product and Company. Attribute company-name is a foreign key from relation Product to relation Company. Attribute rating shows how popular a product is and its values are between 1-5. The following statistics are available about the relations. The following query returns the products with rating of 5 that are produced after 2000 and the states of their companies. SELECT p.name, c. state FROM Product p, Company c WHERE p. company-name = c.name and p. production-year > 2000 and p. rating = 5 Suggest an optimized logical query plan for the above query. Then, estimate the size of each intermediate relation in your query plan. By an intermediate relation, we mean the relation created after each selection or join.

Explanation / Answer

select p.name, c.state

from product p inner join company c

on

(

p.company-name= c.name

and

p.production-year>2000

and

p.rating =5

)

Note: from is the first clause which has to be executed first as per all available clauses