Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider a DB schema consisting of the following relation schemes: Person ( name, age, gender) - Describes person Frequents ( name, pizzeria ) Frequency of

Consider a DB schema consisting of the following relation schemes:

Person ( name, age, gender) - Describes person

Frequents ( name, pizzeria ) Frequency of a person

Eats ( name, pizza ) - What a person is eating

Serves ( pizzeria, pizza, price ) - Information about serves

Write SQL expression for this (all questions please)

1) Find all the persons under the age of 18.

2) Find all the pizzerias that serve at least one pizza that Amy eats for less than $10.00

3) Find all the pizzerias frequented by at least one person under the age of 18

4)Find all the pizzerias frequented by at least one person under the age of 18 and at least one person over the age of 30.

5) Find all pizzerias frequented by at least one person under the age of 18 and at least one person over the age of 30. Print out all the quintuples (pizzeria, person1, age1, person2, age2), where person1 and person2 are persons who frequent the pizzeria, and person1 is under the age of 18 and person2 is over the age of 30.

6) For each person, find how many types of pizzas he/she eats. Show only those people who eat at least two types of pizzas. Sort in descending order of the number of types of pizzas they eat.

7) For each type of pizza, find its average price. Sort descending by average price.

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

Step: 3

blur-text-image

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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions