CUSTOMER (CID, NAME, STREET, CITY, STATE, AGE) SALE (PID. CID, DATE, COST) PART (PID, PNAME, COLOR) The meaning of these relations is straightforward; for example, SALE has one tuple for every part sold to a customer. Primary key attributes are underlined. For instance, PID and CID together form the primary key of relation SALE. SALE.PID is a foreign key that refers to PART.PID, while SALE.CID is a foreign key that refers to CUSTOMER.CID. Write SQL statements for the following retrieval and update operations. 1. Retrieve the names of all the customers from the city of 'Princeton' who bought a part at a cost less than $100. No duplicates should appear in the answer. 2. Retrieve the names of red parts bought by a customer who is younger than 50 and from a customer who is older than 50. 3. Delete all parts that are never bought by a customer from "Trenton" (this is a data change statement). 4. Retrieve the names of the customers who never bought a green part. 5. Retrieve the names of the customers who bought every green item. 6. Find the names and addresses of customers who bought parts averaging more than $100. 7. Retrieve the names of the green parts sold at a price higher than that of every yellow part. 8. For each customer of the city of Newark who bought more than 10 distinct green parts, retrieve his/her CID and the total number of parts that he/she bought.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I need it urgent please

CUSTOMER (CID, NAME, STREET, CITY, STATE, AGE)
SALE (PID, CID, DATE, COST)
PART (PID, PNAME, COLOR)
The meaning of these relations is straightforward; for example, SALE has one tuple for every part sold to a
customer. Primary key attributes are underlined. For instance, PID and CID together form the primary key of
relation SALE. SALE.PID is a foreign key that refers to PART.PID, while SALE.CID is a foreign key that refers to
CUSTOMER.CID.
Write SQL statements for the following retrieval and update operations.
1. Retrieve the names of all the customers from the city of 'Princeton' who bought a part at a cost less than
$100. No duplicates should appear in the answer.
2. Retrieve the names of red parts bought by a customer who is younger than 50 and from a customer who is
older than 50.
3. Delete all parts that are never bought by a customer from "Trenton" (this is a data change statement).
4. Retrieve the names of the customers who never bought a green part.
5. Retrieve the names of the customers who bought every green item.
6. Find the names and addresses of customers who bought parts averaging more than $100.
7. Retrieve the names of the green parts sold at a price higher than that of every yellow part.
8. For each customer of the city of Newark who bought more than 10 distinct green parts, retrieve his/her CID
and the total number of parts that he/she bought.
Edit
View Insert Format
Tools
Table
Transcribed Image Text:CUSTOMER (CID, NAME, STREET, CITY, STATE, AGE) SALE (PID, CID, DATE, COST) PART (PID, PNAME, COLOR) The meaning of these relations is straightforward; for example, SALE has one tuple for every part sold to a customer. Primary key attributes are underlined. For instance, PID and CID together form the primary key of relation SALE. SALE.PID is a foreign key that refers to PART.PID, while SALE.CID is a foreign key that refers to CUSTOMER.CID. Write SQL statements for the following retrieval and update operations. 1. Retrieve the names of all the customers from the city of 'Princeton' who bought a part at a cost less than $100. No duplicates should appear in the answer. 2. Retrieve the names of red parts bought by a customer who is younger than 50 and from a customer who is older than 50. 3. Delete all parts that are never bought by a customer from "Trenton" (this is a data change statement). 4. Retrieve the names of the customers who never bought a green part. 5. Retrieve the names of the customers who bought every green item. 6. Find the names and addresses of customers who bought parts averaging more than $100. 7. Retrieve the names of the green parts sold at a price higher than that of every yellow part. 8. For each customer of the city of Newark who bought more than 10 distinct green parts, retrieve his/her CID and the total number of parts that he/she bought. Edit View Insert Format Tools Table
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY