Question: SQL Coding Based on the UML diagram given below, answer the following question Report out the customer number of every customer who has never made
SQL Coding
Based on the UML diagram given below, answer the following question
- Report out the customer number of every customer who has never made a payment on the same date as another customer. Note, you will need the except for this. Order by customer number. Returns 33 rows.
- Report the employee number, last name, and first name of every employee who is not a manager. Remember that the reportsTo field in employee carries the employee number of the manager of that employee. Sort by last name, then first name. Returns 17 rows.
- List the first customer name, their city, state, country, and the second customer name for every pair of customers who share the same city, state, country, and sales rep. Remember that the customer table has the salesRepEmployeeNumber which is the surrogate for the Employee who serves as that customers sales representative. Also remember that the state may be null, so frame your join accordingly. Be sure to show a given pair of customers only once. For instance, I do not want to see one row with American Souvenirs Inc and Super Scale Inc. and then, later, a row that is Super Scale Inc. and American Souvenirs Inc. Order by the first customer name, then the second. Returns 18 rows.
- Report out the last name, the first name, and the type of employee for three classes of employee: those who dont report to anyone, those who report to anyone who doesnt report to anyone, and those who report to those who report to anyone who doesnt report to anyone. The type of employee will be Big Kahuna in the first case, 1st Level Down in the second case, and 2nd Level Down in the third case. Order by the last name, then the first name. Returns 7 rows: 1 in the first type, 2 in the second, and 4 in the third type. Broad hint, you are going to have to do two unions for this.
- For all pairs of orders that share the same order date, shipped date, and status, report the order numbers, their order date, shipped data and status. Be careful not to show a given pair of orders twice. Order by the first order number, then the second. Returns 15 rows.


The MySQL sample database schema consists of the following tables: Customers: stores customer's data. Products: stores a list of scale model cars. ProductLines: stores a list of product line categories. Orders: stores sales orders placed by customers. Order Details: stores sales order line items for each sales order. Payments: stores payments made by customers based on their accounts. Employees: stores all employee information as well as the organization structure such as who reports to whom. Offices: stores sales office data. Order Details -quantityOrdered |-priceEach -orderline Number Showcase> ProductLines -productLine -textDescription -htmlDescription -image Products -product Code -productName -productScale -productVendor 1-product Description -quantityInStock -buyPrice -MSRP 1..* 1..1 1..* 0.. contains -is supervised by Orders -orderDate -requiredDate -shippedDate -status -comments Employees -lastName -firstName -extension -email -reportsTo:Employee -jobTitle 0..1 Place> 1... 1... -supervises> Service> 1..1 1.. 0..1 Customers -customer Name - contactLastName -contactFirstName -phone -addressLine1 -addressLine2 -city -state -postalCode -country -creditLimit Remit> Payments -checkNumber 4-paymentDate -amount 1.. 1..* Offices -city -phone -addressLine1 -addressLine2 -state -country -postalCode -territory 1..1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
