Question
Normalization and SQL Join Need sql for: This is how the output should look when completed. Display customers, their orders, and the most expensive unit
Normalization and SQL Join
Need sql for: This is how the output should look when completed.
Display customers, their orders, and the most expensive unit price in the order. Show customer ID, customer name, orderID, Order Date, and unit price for the most expensive item in the order
CustomerID | CustomerName | OrderID | OrderDate | Highest Unit Price in Order |
1 | Just Electronics | 1 | 2917-01-03 | 1499.99 |
1 | Just Electronics | 2 | 2017-03-05 | 1599.99 |
1 | Just Electronics | 5 | 2017-05-03 | 199.99 |
2 | Beyond Electronics | 3 | 2017-02-23 | 1449.99 |
3 | Beyond Electronics | 6 | 2917-05-08 | 1499.99 |
4 | E Fun | 4 | 2017-04-13 | 99.99 |
5 | Overstock E | 7 | 2016-11-08 | 999.99 |
7 | Electronics4U | 8 | 2016-12-23 | 79.99 |
My SQL
Having a problem on price right now
Select CustomerID, CustomerName, OrderID, OrderDate MAX(Price) AS "Highest Unit Price in Order" From Sales.OrderDetails JOIN Sales.Orders ON Sales.OrderDetails = Sales.Orders Group BY CustomerID
HR.Employees D EEE Purchasing.Deliveries Purchasing,Products PurchasingSuppliers SalesCustomers Sales.OrderDetails Columns Orderld (PK, FK, int, not null) o Productld (PK, FK, int, not null) Price (money, not null) E quantity (smallint, not null) DKeys Constraints Triggers Indexes Statistics E Sales.Orders Columns Orderld (PK, int, not null) CustomerId (FK, int, not null) Employeeld (FK, int, not null) o E OrderDate (date, not null) Keys
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started