Question: Assignment 4 : Advanced MS SQL Stored Procedures Individual Assignment | 7 . 5 % Objective: To design and implement stored procedures with error handling
Assignment : Advanced MS SQL Stored Procedures
Individual Assignment
Objective:
To design and implement stored procedures with error handling and transactions for a retail store
management system. You ate required create tables and write stored procedures to handle various
business transactions and generate reports.
Step
Create Below Tables Make sure to use logically use correct Data Types, PKs FKs other
required constrains based on Step
A Customer
a CustomerID
b FirstName
c LastName
d Email
e Phone
B Products
a ProductID
b ProductName
c Price
d Stock
C Orders
a OrderID
b CustomerID
c OrderDate
D OrderDetails
a OrderDetailID
b OrderID
c ProductID
d Quantity
e Price
Step
Populate all the above tables with below dummy data
Insert Dummy Data into Customers Table
INSERT INTO Customers FirstName LastName, Email, Phone
VALUES
John 'Doe', 'john.doe@example.com',
Jane 'Smith', 'jane.smith@example.com',
Assignment : Advanced MS SQL Stored Procedures
Individual Assignment
Jim 'Beam', 'jim.beam@example.com',
Jill 'Valentine', 'jill.valentine@example.com', ;
Insert Dummy Data into Products Table
INSERT INTO Products ProductName Price, Stock
VALUES
Laptop
Smartphone
Tablet
Headphones;
Insert Dummy Data into Orders Table
INSERT INTO Orders CustomerID OrderDate
VALUES
;
Insert Dummy Data into OrderDetails Table
INSERT INTO OrderDetails OrderID ProductID, Quantity, Price
VALUES
;
Assignment : Advanced MS SQL Stored Procedures
Individual Assignment
Step
Create below Stored Procedures
Create a stored procedure AddCustomer that inserts a new customer into the
Customers table. Include error handling and transactions.
Create a stored procedure AddProduct that inserts a new product into the Products
table. Include error handling and transactions.
Create a stored procedure CreateOrder that inserts a new order and its details into
the Orders and OrderDetails tables, respectively. It should also update the product
stock. Include error handling and transactions. Create a stored procedure
UpdateCustomer that updates the details of an existing customer. Include error
handling and transactions.
Create a stored procedure DeleteCustomer that deletes a customer from the
Customers table. Include error handling and transactions.
Create a stored procedure UpdateProduct that updates the details of an existing
product. Include error handling and transactions.
Create a stored procedure DeleteProduct that deletes a product from the Products
table. Include error handling and transactions.
Create a stored procedure ProcessReturn that processes a return of items by
updating the OrderDetails and Products tables. Include error handling and
transactions.
Create a stored procedure GenerateSalesReport that generates a sales report for a
given date range.
Create a stored procedure TrackInventory that lists products with low stock less
than
Create a stored procedure AddCustomerFeedback to insert feedback into the
CustomerFeedback table. Ensure the CustomerFeedback table is created first.
Submission Instructions:
Complete each task and create the stored procedures as outlined.
Test each stored procedure to ensure it works correctly and handles errors appropriately.
Submit a single SQL script file containing all your stored procedures.
Include a screenshot of the output for each stored procedure as evidence of
successful execution.
Assignment : Advanced MS SQL Stored Procedures
Individual Assignment
Evaluation Criteria:
Correctness of SQL syntax and logic
Implementation of error handling and transactions
Successful execution of stored procedures
Clarity and organization of submitted SQL script
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
