0% found this document useful (0 votes)
2 views1 page

Assignment Triggers

The document outlines an assignment for a Database Systems course at COMSATS University Islamabad, focusing on managing the backend of an online store. It includes SQL table structures for Products, Customer, and Orders, along with requirements for auditing changes in the Orders table by logging operations in an AuditLog_orders table and handling deletions and updates in separate tables. The assignment is to be completed within three days and carries a maximum of 10 marks.

Uploaded by

Roman Regin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Assignment Triggers

The document outlines an assignment for a Database Systems course at COMSATS University Islamabad, focusing on managing the backend of an online store. It includes SQL table structures for Products, Customer, and Orders, along with requirements for auditing changes in the Orders table by logging operations in an AuditLog_orders table and handling deletions and updates in separate tables. The assignment is to be completed within three days and carries a maximum of 10 marks.

Uploaded by

Roman Regin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

COMSATS University Islamabad, Lahore Campus

Block–B, Department of Computer Engineering


COMSATS University Islamabad, Lahore Campus 1.5KM Defence Road, Off Raiwind Road, Lahore

Assignment
Database Systems
Course Title: Course Code: CSC270 Credit Hours: 4(3,1)

Course Programme
Modassir Ishfaq BCE
Instructor/s: Name:
Semester: 4th Batch: Fa23 Section: A&B Date:
Time Allowed: Within 3 days Maximum Marks: 10
Student’s Name: Reg. No.

Question:
You are managing the backend of an online store. Customers place orders, and the system must deduct
inventory and record the transaction safely. The following tables are in use:

CREATE TABLE Products (


ProductID INT PRIMARY KEY,
ProductName VARCHAR(100),
Stock INT,
Price DECIMAL(10,2), flag BOOL
);

CREATE TABLE Customer (


customerID INT PRIMARY KEY,
CustomerName VARCHAR(100),
Balance INT,
DateofJoining DATETIME
);

CREATE TABLE Orders (


OrderID INT IDENTITY(1,1) PRIMARY KEY,
ProductID INT,
CustomerID INT,
Quantity INT,
TotalAmount DECIMAL(12,2),
OrderDate DATETIME DEFAULT GETDATE()
);

You want to audit all changes (INSERT, UPDATE, DELETE) on orders table and record them in an
AuditLog_orders table with information such as Operation type (INSERT / UPDATE / DELETE), User ID,
orderID, Timestamp of change. In case of deletion, the data must be logged in a separate table. In case of
update, it must log the attribute, its old value and new value in another separate table. Therse separate tables
must have a link with the auditlog ID.

You might also like