Answered step by step
Verified Expert Solution
Link Copied!

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

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions

Question

is 2 2 4 . 1 0 . 0 . 2 5 4 / 2 4 a host address

Answered: 1 week ago