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 (look for TODO items).
List all customers in database (listAllCustomers) | 3 marks |
List all orders for a customer (listCustomerOrders) | 3 marks |
List all lineitems for an order (listLineItemsForOrder) | 2 marks |
Computer order total (computeOrderTotal) | 2 marks |
Add a customer (addCustomer) | 2 marks |
Delete a customer (deleteCustomer) (Make sure to also delete Orders and OrderedProducts for the customer deleted). | 2 marks |
Update a customer (updateCustomer) | 2 marks |
New order (newOrder) | 2 marks |
New order item (newLineItem) | 2 marks |
Update order total (updateOrderTotal) | 2 marks |
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