Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with questions about SQL queries using this ER Diagram Questions List the names of all customers who have placed an order and the total

Help with questions about SQL queries using this ER Diagram

image text in transcribed

Questions

  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.

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

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

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

Students also viewed these Databases questions

Question

2. How were various roles filled?

Answered: 1 week ago