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

Write the SQL commands for the following queries using the tables above 5. Displ

ID: 670333 • Letter: W

Question

Write the SQL commands for the following queries using the tables above

5.       Display a list of products (Show ProductID and ProductDescription as the first two columns) for the products that have been ordered for at least three times. Display (as the third column) the number of times these products have been ordered.

6.       For order # 1001, find ProductID, OrderedQuantity, ProductStandardPrice, and the total price (OrderedQuantity x ProductStandardPrice) for each product item involved in this order.

Explanation / Answer

** first table is created and values given to the fields:

CREATE TABLE Product

   (`id` int, `productDesc` varchar(9) , `orders` int );

  

INSERT INTO Product

   (`id`, `productDesc` ,`orders` )

VALUES

   (1, 'TV' , 3 ),

   (2, 'AC',2 ),

   (3, 'COMPUTER',4 )

;

Answer 5: SQL commands

this sign .

SELECT

id, productDesc ,orders

FROM

Product

WHERE

orders >='3'