https://github.com/mennasayed46/c43_g01_db08
A set of SQL problem-solving tasks
https://github.com/mennasayed46/c43_g01_db08
dcl index indexed-view security sql sql-server sqlmanagement sqlprofiler tcl
Last synced: 6 months ago
JSON representation
A set of SQL problem-solving tasks
- Host: GitHub
- URL: https://github.com/mennasayed46/c43_g01_db08
- Owner: MennaSayed46
- Created: 2025-07-21T02:19:14.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-07-28T14:07:15.000Z (6 months ago)
- Last Synced: 2025-07-28T16:09:24.307Z (6 months ago)
- Topics: dcl, index, indexed-view, security, sql, sql-server, sqlmanagement, sqlprofiler, tcl
- Language: TSQL
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SQL Server Academic Project - README
## Part 01 β Working with ITI Database
### π Task 1: Index on Department Table
- Create an index on the column `Hiredate` that allows clustering the data in the `Department` table.
- **Question:** What will happen when you try this?
---
### π Task 2: Unique Index on Student Table
- Create an index that enforces uniqueness on the `Age` column in the `Student` table.
- **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**:
- `Student` table
- `Course` table
- **Permissions**:
- Allow: `SELECT`, `INSERT`
- Deny: `UPDATE`, `DELETE`
---
## 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 `ReturnedBooks` table.
- Logic:
- If `ReturnDate` is **after** `DueDate`, calculate a fee.
- Fee = 20% of the amount previously paid.
---
### π Task 6: Restrict Actions on `Employee` Table
- Create a trigger to **prevent any `INSERT`, `UPDATE`, or `DELETE`** operations on the `Employee` table.
- 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 `Salary` column in the `Employee` table.
- **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:
- `Employee` table
- `Floor` table
- **Permissions**:
- Allow: `SELECT`, `INSERT`
- Deny: `UPDATE`, `DELETE`
- β Donβt forget to take **screenshots of each step**.
---
> π‘ *Note: Make sure to test each step and validate behavior through SQL Server Management Studio.*