Answered step by step
Verified Expert Solution
Question
1 Approved Answer
SELECT name, SUM ( length ) FROM MovieExec, Movies WHERE producerC# = cert# GROUP BY name HAVING MIN ( year ) 1 9 3 0
SELECT name, SUM length
FROM MovieExec, Movies
WHERE producerC# cert#
GROUP BY name
HAVING MINyear;
Figure : Computing the total length of film for early producers
Exercises for Section
Exercise : Write each of the queries in Exercise in SQL making
sure that duplicates are eliminated.
Exercise : Write each of the queries in Exercise in SQL making
sure that duplicates are eliminated.
Exercise : For each of your answers to Exercise determine whether
or not the result of your query can have duplicates. If so rewrite the query
to eliminate duplicates. If not, write a query without subqueries that has the
same, duplicatefree answer.
Exercise : Repeat Exercise for your answers to Exercise
Exercise : In Example we mentioned that different versions of the
query "find the producers of Harrison Ford's movies" can have different answers
as bags, even though they yield the same set of answers. Consider the version
of the query in Example where we used a subquery in the FROM clause.
Does this version produce duplicates, and if so why?
Exercise : Write the following queries, based on the database schemaPCmodel speed, ram, hd price
Laptopmodel speed, ram, hd screen, price
Printermodel color, type, priceof Exercise and evaluate your queries using the data of that exercise.
a Find the average speed of PCs
b Find the average speed of laptops costing over $
c Find the average price of PCs made by manufacturer A
d Find the average price of PC s and laptops made by manufacturer D
e Find, for each different speed, the average price of a PC
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started