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.
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...
Related questions
Question
I need it urgent please
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Recommended textbooks for you
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY