ME
MennaSayed46/C43_G01_DB08
A set of SQL problem-solving tasks
SQL Server Academic Project - README
Part 01 β Working with ITI Database
π Task 1: Index on Department Table
- Create an index on the column
Hiredatethat allows clustering the data in theDepartmenttable. - Question: What will happen when you try this?
π Task 2: Unique Index on Student Table
- Create an index that enforces uniqueness on the
Agecolumn in theStudenttable. - Question: What will happen when you try this?
π Task 3: Create Login RouteStudent
- Create a SQL Server login named
RouteStudent. - Grant this login access to only:
StudenttableCoursetable
- Permissions:
- Allow:
SELECT,INSERT - Deny:
UPDATE,DELETE
- Allow:
Part 02 β Advanced Table & Trigger Logic
π Task 4: Create ReturnedBooks Table
Create a table named ReturnedBooks with the following structure:
| Column Name | Data Type |
|---|---|
| UserSSN | |
| BookId | |
| DueDate | |
| ReturnDate | |
| Fees |
π Task 5: Trigger on ReturnedBooks
- Create an INSTEAD OF INSERT trigger on the
ReturnedBookstable. - Logic:
- If
ReturnDateis afterDueDate, calculate a fee. - Fee = 20% of the amount previously paid.
- If
π Task 6: Restrict Actions on Employee Table
- Create a trigger to prevent any
INSERT,UPDATE, orDELETEoperations on theEmployeetable. - The trigger must display a message to notify the user that actions on this table are not permitted.
π Task 7: Index on Salary in Employee Table
- Create a clustered index on the
Salarycolumn in theEmployeetable. - Question: What happens when this index is applied?
π Task 8: Create Login with Your Name
- Create a login using your name (e.g.,
MennaLogin). - Grant access only to:
EmployeetableFloortable
- Permissions:
- Allow:
SELECT,INSERT - Deny:
UPDATE,DELETE
- Allow:
- β Donβt forget to take screenshots of each step.
π‘ Note: Make sure to test each step and validate behavior through SQL Server Management Studio.