Consider the following relational schema Peopleperson id per

Consider the following relational schema:

People(person id, person name)

Purchases(purchase id, person id, cost)

What is the intention of following queries? Do they return the same tuples on any database instance? Explain your answer

a. SELECT person_id FROM Purchases GROUP BY person_id HAVING max ( cost ) < 100

b. SELECT person_id FROM People WHERE person_id NOT IN ( SELECT person_id FROM Purchases WHERE cost >= 100)

Solution

yes they do have intention to give same details of data of db.

a. it means we have to group persons who have purchased things having cost less than 100 from \'Purchases table\'. As a result we get names of those id\'s from \'People table\' if we link them.

b. This query means not to select the people who purchased things of cost more than or equal to 100.

so ultimately both means the same.....here data of people ids who purchased things of cost less than 100 is obtained.So the same tuples is obtained.

Consider the following relational schema: People(person id, person name) Purchases(purchase id, person id, cost) What is the intention of following queries? Do

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site