Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

any1 know how to do these? Write queries to conduct the following tasks on the P

ID: 3547341 • Letter: A

Question


any1 know how to do these?

Write queries to conduct the following tasks on the PVFG database (pvfg. sql, which is provided in Moodle 2). The schema of the database is as follows: Display CustomerlD, CustomerName of all customers who have placed orders, along with the order ID for all the orders they have placed. List CustomerlD, CustomerName, and OrderlD for all customers. Include the ID and names of customers even if they haven't placed any order yet. What is the name of the customer who placed order number 1008? What are the order IDs of orders placed by customers living in TX? What types of ProductFinish are ordered by customers living in TX? Display the total ordered quantity of each product together with their ProductlD. Display the total ordered quantity of each product together with their product ID and ProductDescription. List CustomerlD, customerName of all customers who did not make any orders (use subqueries and NOT IN). Use subqueries to find the name of the customer who placed order number 1008? What are the order IDs of orders placed by customers living in TX? Show the description of the most expensive product.

Explanation / Answer

1. select c.customer_id ,c.customer_name o.order_id

from customer c, order o

where o.cutomer_id=c.customer_id


2.select c.customer_id ,c.customer_name o.order_id

from customer c, order o

where o.cutomer_id=c.customer_id or o.customer_id <>c.customer_id


3.select c.customer_name

from customer c, order o

where o.cutomer_id=c.customer_id and o.order_id=1008


4.select o.order_id

from customer c, order o

where o.cutomer_id=c.customer_id and c.customer_city = "TX"