Question: Urgent help please! Products table [ [ Id , name,price,Quantity ] , [ 1 , T - shirt, 1 9 . 9 9 ,

Urgent help please!
Products
\table[[Id,name,price,Quantity],[1,T-shirt,19.99,50],[2,Hoodle,39.99,25],[3,Hat,9.99,100]]
\table[[id,Name],[1,John Smith],[2,Smith Doe],[3,Bob Johnson]]
Orders
Orders
\table[[id,date,customer_id],[1,115?22,1],[2,220?22,1],[3,225?22,3]]
Order Lines
\table[[id,order_id,product_id,quantity],[1,1,1,2],[2,2,2,5],[3,2,3,1],[4,3,1,1]]
Write the results of the following queries:
\table[[\table[[1-SELECT * FROM CUSTOMERs where name],[like '%Smith%:;]],\table[[2- SELECT * from Customers WHERE],[id not in (select customer_id from orders);]]],[\table[[3-SELECT customer.name, count(*?** FROM],[orders o, customers C WHERE],[o.customer_id=c.id GROUP BY],[customer.name;]],\table[[4-SELECT p.name, avg(p-price * I. quantity)],[FROM orders o, order_lines I, Products p],[WHERE p.id=l.product_id and I.order_id=o.id],[GROUP BY p.name;]]],[\table[[customer.name;],[5- SELECT customer_id, SUM(I.quantity*p.pri],[FROM Orders o, order_line I, products p],[WHERE customer_id IN (]]],[HAVING COUNT(DISTINCT order,]]
and p.id=l.product_id and l.order_id=
0.id
GROUP BY customer_id;Products
\table[[Id,name,price,Quantity],[1,T-shirt,19.99,50],[2,Hoodie,39.99,25],[3,Hat,9.99,100]]
\table[[id,Name],[1,John Smith],[2,Smith Doe],[3,Bob Johnson]]
Orders
Orders
\table[[id,date,customer_id],[1,115?22,1],[2,220?22,1],[3,225?22,3]]
Order Lines
Order Lines
\table[[id,order_id,product_id,quantity],[1,1,1,2],[2,2,2,5],[3,2,3,1],[4,3,1,1]]
Write the results of the following queries:
\table[[\table[[1-SELECT * FROM CUSTOMERs where name],[like '%Smith%';]],\table[[2- SELECT * from Customers WHERE],[id not in (select customer_id from orders):]]],[\table[[like % Smith%;],[3-SELECT customer.name, count(*) FROM],[orders o, customers c WHERE],[o.customer_id=c.id GROUP BY]],\table[[4-SELECT p.name, avg(p.price * I. quantity)],[FROM orders o, order_lines I, Products p],[WHERE p.id=l.product_id and I.order_id=0.id]]],[customer.name;,GROUP BY p.name;]]
5- SELECT customer_id, SUM(I.quantity ?**p.price) as total_revenue
FROM Orders o, order_line 1, products p
WHERE customer_id IN I
SELECT customer_id
FROM Orders
GROUP BY customer_id
HAVING COUNT(DISTINCT order_id)>1
and p.id=l.product_id and I.order_id=
o.id
GROUP BY customer_id;
 Urgent help please! Products \table[[Id,name,price,Quantity],[1,T-shirt,19.99,50],[2,Hoodle,39.99,25],[3,Hat,9.99,100]] \table[[id,Name],[1,John Smith],[2,Smith Doe],[3,Bob Johnson]] Orders Orders

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!