Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using sql for mysql workbench List products for Motorcycle, Ship, and Train product lines that have quantity in stock. (Hint: You can do this with

image text in transcribedusing sql for mysql workbench

  1. List products for Motorcycle, Ship, and Train product lines that have quantity in stock.

(Hint: You can do this with a combination of AND/OR constructs. If you do, be sure to use parenthesis to group the operations. Otherwise you can do this with a single AND and an IN comparison operator. You can look up the IN operator in the MySQL reference manual.)

  1. List product line, product code, product name, and total ordered quantity sorted by total ordered quantity in decreasing order. Include products with no orders (return 0 total quantity ordered for products with no orders).

  1. List the names of customers and how many distinct products they have ordered where that customer has ordered 40 or more distinct products.

(Hint: Make sure you get only distinct products.)

  1. List the names of all customers who have placed an order and the total dollar amount ordered by that customer.

(Hint: To get the dollar amount for an order, you will need to multiply the order quantity by the price each in the order detail table.)

  1. List the names and customer numbers of all customers and the total dollar amount paid by that customer. If the customer hasnt made any payments, list 0 for the total amount paid for that customer.

Extra Credit

  1. List the names of all customers who have placed an order, the total dollar amount ordered for all orders for that customer, the dollar amount paid for all orders for that customer and the outstanding balance (amount that has not yet been paid) for each customer.

(Hint: If you try to mix the inner and outer joins for this query in the same FROM clause, you will probably get a meaningless result. Instead, use the queries from questions 9 and 10. Embed one of them as a subquery in the FROM clause of the other while adding the extra items being computed in the embedded query in the appropriate places in the primary query.)

(Note: Make sure your entire query shows in the query pane and at least two rows of the results appear in the results grid. You may need to resize panes to accomplish this.)

off eCode VARCHAR(10) city: VARCHARS0) phone: VARCHAR(S0) addinessline l: VARCHAR(SO) orderlumber INTEGER orderNumber: INTEGER productCode: VARCHARC5) 9 orderOute DATETIME MALLINT comments: TEXT customer% mber INTEGER country: VARCHARSO) postalCode VARCHARIS) sales Repltmplyeeumber: INTEGER productcode: VARCHAR(25) productName: VARCHAR70 VARCHAR(10) 9 extension: VARCHARO) produenendor. VARCHAR(50) ARCHAR(SO) quastylaStock INTEGER 0 buy Price: DOUBLE off eCode VARCHAR(10) city: VARCHARS0) phone: VARCHAR(S0) addinessline l: VARCHAR(SO) orderlumber INTEGER orderNumber: INTEGER productCode: VARCHARC5) 9 orderOute DATETIME MALLINT comments: TEXT customer% mber INTEGER country: VARCHARSO) postalCode VARCHARIS) sales Repltmplyeeumber: INTEGER productcode: VARCHAR(25) productName: VARCHAR70 VARCHAR(10) 9 extension: VARCHARO) produenendor. VARCHAR(50) ARCHAR(SO) quastylaStock INTEGER 0 buy Price: DOUBLE

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions

Question

Define Management or What is Management?

Answered: 1 week ago

Question

What do you understand by MBO?

Answered: 1 week ago

Question

What is meant by planning or define planning?

Answered: 1 week ago