Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Customer (CustomerId, CustomerName) Employee (EmployeeId, EmployeeName, Salary, SupervisorId ) Product(ProductId, ProductName, ListPrice) Orders (OrderId, OrderDate, CustomerId , EmployeeId , Total) OrderedProduct ( OrderId , ProductId
Customer (CustomerId, CustomerName) Employee (EmployeeId, EmployeeName, Salary, SupervisorId) Product(ProductId, ProductName, ListPrice) Orders (OrderId, OrderDate, CustomerId, EmployeeId, Total) OrderedProduct (OrderId, ProductId, Quantity, Price)
Write the code to complete the methods in OrderJDBC.java
Query1: Return the list of products that have not been in any order. Hint: Left join can be used instead of a subquery. | 3 marks |
Query2: Return the order ids and total amount where the order total does not equal the sum of quantity*price for all ordered products in the order. | 3 marks |
Query3: Return for each customer their id, name and average total order amount for orders starting on January 1, 2015 (inclusive). Only show customers that have placed at least 2 orders. | 3 marks |
Query4: Return the employees who have had at least 2 distinct orders where some product on the order had quantity >= 5. | 4 marks |
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