Question: Help with questions about SQL queries using this ER Diagram Questions List all customers names with each product that customer has ordered. Include customers who

Help with questions about SQL queries using this ER Diagram

Help with questions about SQL queries using this ER Diagram Questions List

Questions

  1. List all customers names with each product that customer has ordered. Include customers who do not have an order. Include the product name of the item ordered. If a customer has ordered the same product multiple times, only list the product once for that customer.

(Hint: you will need to join 4 tables.)

  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 parentheses 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).

  2. 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.)

employees employeeNumber INT (11) lastName VARCHAR(50) firstName VARCHAR(50) HH extension VARCHAR(10) email VARCHAR(100) officeCode VARCHAR(10) reportsTO INT(11) jobTitle VARCHAR(50) - + customers customerNumber INT(11) customerName VARCHAR(50) contact astame VARCHAR(50) contactFirstam e VARCHAR(50) phone VARCHAR(50) addressLine1 VARCHAR(50) addressLine2 VARCHAR(50) city VARCHAR(50) state VARCHAR(50) HE postal Code VARCHAR(15) country VARCHAR(50) salesRepEmployeeNumber INT(11) creditLimit DOUBLE offices officeCode VARCHAR(10) city VARCHAR(50) phone VARCHAR(50) addressLine1 VARCHAR(50) addressLine2 VARCHAR(50) state VARCHAR(50) country VARCHAR(50) postal Code VARCHAR(15) territory VARCHAR(10) orderdetails orderNumber INT(11) product Code VARCHAR(15) quantityOrdered INT(11) priceEach DOUBLE orderlineNumber SMALLINT (6) dates FullDate DATE MonthName CHAR(3) YearNumber INT (11) QuarterNumber INT(11) Notes VARCHAR(150) payments customerNumber INT (11) check Number VARCHAR(50) paymentDate DATETIME amount DOUBLE orders orderNumber INT (11) orderDate DATETIME requiredDate DATETIME shippedDate DATETIME status VARCHAR(15) comments TEXT customerNumber INT (11) products productCode VARCHAR(15) productName VARCHAR(70) productLine VARCHAR(50) productScale VARCHAR(10) productVendor VARCHAR(50) productDescription TEXT quantityInStock SMALL INT(6) buyPrice DOUBLE productlines productLine VARCHAR(50) - textDescription VARCHAR(4000) htm|Description MEDIUMTEXT image MEDIUMBL OB MSRP DOUBLE

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!