Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 1 Create database and DB objects based on the below ER Diagram Create a database called Orders. Create DDL scripts for the database objects
Part Create database and DB objects based on the below ER Diagram
Create a database called Orders. Create DDL scripts for the database objects and enforce referential integrity and PK Show the CREATE TABLE statements with the modifications including the constraints given in step
Add the following constraints:
tblCustomers table: Country default to Canada
tblOrderDetails: Quantity
tblShippers: CompanyName must be unique.
tblOrders: ShippedDate must be greater than order date.
Run the script provided to populate the data on the table InsertScriptsql
Part Create the Following SQL Statements
Show a list of customers and the orders they generated during Display customer ID order ID order date and date ordered.
Using the ALTER TABLE statement, add a new field Active in the tblcustomer. Default it to True.
Show all orders purchased before September Display company name, date ordered and total amount of order include freight
Show all orders that have been shipped via Federal Shipping. Display OrderID, ShipName, ShipAddress and CustomerID.
Show all customers who have not made purchases in
Show all products that have never been ordered.
Show OrderIDs for customers who reside in London. Use a subquery. Display CustomerID, CustomerName and OrderID.
Show products supplied by Supplier A and Supplier B Display product name and supplier name.
Show all products that come in boxes. Display product name and QuantityPerUnit.
Part Insert, Update, Delete, Indexes
Create an Employee table. The primary key should be EmployeeID autonumber Add the following fields: LastName, FirstName, Address, City, Province, Postalcode, Phone, Salary. Show the CREATE TABLE statement and the INSERT statements for the five employees. Join the employee table to the tblOrders. Show the script for creating the table, setting constraints and adding employees.
Add a field to tblOrders called TotalSales. Show DDL ALTER TABLE statement.
Using the UPDATE statement, add the total sale for each order based on the order details table.
add additional column in tblCustomer called LatestCustomerOrderQuantity
update LatestCustomerOrderQuantity with the quanitity of all the products in lastest customer order
add adtional column in TbleCustomer called TotalAmountofOrders
update TotalAmountofOrders with the total amount the customer spent on all the orders heshe made you may not need to include the shipping cost
find the details of the most recent order by the customer
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