Write a SELECT statement that joins the Categories table to the Products table a
ID: 3669032 • Letter: W
Question
Write a SELECT statement that joins the Categories table to the Products table and returns these columns: category_name, product_name, list_price. Sort the result set by category_name and then by product_name, both in ascending sequence. (...feel free to use table alias names to make your SQL statements easier to code and read...) 10 records should display in your result Write a SELECT statement that joins the Customers, Orders, order_items, and Products tables. This statement should return these columns: last_name, first_name, order_date, product_name, item_price, discount_amount, and quantity. Use aliases for the tables. Sort the final result set by last_name, order_date, and product_name. Write a SELECT statement that returns these two columns: category_name The category_name column from the Categories table product_id The product_id column from the Products table Return one row for each category that has never been used. Use table alias names. Use the UNION operator to generate a result set consisting of three columns from the Orders table: The 3 columns will be: If the order has a value in the ship date column, the ship status column should contain a value of SHIPPED. Otherwise, it should contain a value of NOT SHIPPED.Explanation / Answer
1A)SELECT Categories.catgories_name,Products.product_name,Products.list_price FROM Categories
INNER JOIN Products
ON Categories.catgories_name=Product.catgories_name
ORDER BY catgories_name ASC, product_name ASC;
2A)
SELECT C.last_name,C.first_name,O.order_date,P.product_name,Oi.Item_price,
O.discount_amount,P.quantity FROM
(Customers Alias C INNER JOIN Order Alias O ON C. first_name= O. first_name)
INNER JOIN Order_Items Alias Oi ON(Oi.order_date=O.order_date)
INNER JOIN Products Alias P ON(P. product_name=Oi. product_name)
ORDER BY last_name,order_date,product_name;
3A) SELECT C.catgories_name,P.product_id FROM
Categories Alias C LEFT OUTER JOIN Products Alias P ON(C.catgories_name=P.catgories_name);
4A)SELECT
(SHIPPED INNER JOIN ORDER Shipped.ship_date NOT NULL SHIPPED.ship_staus= Shipped ) As ship_staus UNION order_id,order_date FROM Order;
5A)
SELECT Customer.first_name,Customer.last_name,Address.line1,Address.city,Address.state,Address.zip_code
FROM Customer LEFT OUTER JOIN Address ON
(Customer.first_name = Address.first_name AND Customer. address= Address.line1);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.