Assignment Instruction 1. Using MySQL Workbench, create a new schema for this assignment and import assignment2.sql. 2. Reverse-engineer the database to produce the ER diagram for this database. Rely...

1 answer below »


Assignment Instruction


1. Using MySQL Workbench, create a new schema for this assignment and import assignment2.sql.


2. Reverse-engineer the database to produce the ER diagram for this database. Rely on the ERD to perform remaining tasks.


3. Write and execute SQL commands to get information from the database:



i. Display a single number showing the total number of customers in the database.



ii. Display a single number showing how many products categories are available (do not include duplicates).



iii. Display a single number showing how many shipping addresses are from Ontario.



iv. Join the payment_info and payments table together based on PK/FK. Display the count of records for each payment type.



v. Display a single number showing how many invoices were issued in 2013.



vi. Join the customers and shipping_details tables together based on PK/FK. Display the province code and the number of records per province. Data should be sorted in descending order of the number of records.



vii. Display the lowest, highest, and median amounts on the invoice table?



viii. Join the customers and customer_product tables together based on PK/FK. The SQL should display the customer’s first and last names, the email (in uppercase) and the ordered amount. Only records where the ordered_amount is greater or equal to 5 should be displayed.



ix. Referring to the customers and shipping_details tables on the ER, display all data from the customers table but only where the province on the shipping_details table is equal to NS. Do not use a join for this requirement.




4.

Copy and paste each of the SQL statements from #3 into a single Word document. Make sure to specify the requirement number ahead of the SQL, i.e., 3i, 3ii, etc. If the file does not include the requirement number before the SQL, the submission will not be graded.





Answered Same DayJul 21, 2022

Answer To: Assignment Instruction 1. Using MySQL Workbench, create a new schema for this assignment and import...

Aditi answered on Jul 21 2022
60 Votes
ASSIGNMENT
3.i Display a single number showing the total number of customers in the database.
SELE
CT COUNT(customer_id) AS TotalNumberOfCustomers FROM customers;
 
3.ii. Display a single number showing how many products categories are available (do not include duplicates).
SELECT COUNT(DISTINCT category) FROM products;
 
3.iii. Display a single number showing how many shipping addresses are from Ontario.
SELECT COUNT(shipping_detail_id) FROM shipping_details WHERE province = 'ON';
 
3.iv. Join the payment_info and payments table together based on PK/FK.  Display the count of records for each payment type.
SELECT COUNT(payment_info.payment_type) FROM payment_info INNER JOIN payments ON payment_info.payment_info_id=payments.payment_info_id;
 
3.v....
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here