Individual Advanced Database Laboratory Practical Assignment
Individual Advanced Database Laboratory Practical Assignment
Assignment Information
Instructions:
• Complete all tasks using Microsoft SQL Server or Oracle DB.
• Provide both the SQL code and a brief explanation of your approach.
• Test your solutions to ensure they work correctly.
1. Database Setup & Basic Queries
Task 1:
• Install Microsoft SQL Server or Oracle DB (if not already done).
• Create a database named UniversityDB with the following tables:
o Students (StudentID, Name, Email, Department)
3. Query Optimization
Task 4:
• Take the following slow-running query:
Sql
SELECT * FROM Students
WHERE Department = 'Computer Science'
ORDER BY Name;
• Optimize it by:
o Adding an appropriate index.
o Rewriting the query if necessary.
• Explain why your optimization improves performance.
Task 5:
• Compare the execution plans of:
Sql
SELECT s.Name, e.Grade
FROM Students s
JOIN Enrollments e
ON s.StudentID = e.StudentID;
8. Distributed Databases
Task 12:
• Design a fragmentation strategy for UniversityDB if it were distributed across
three campuses.
• Explain whether you chose horizontal or vertical fragmentation.
9. Triggers & Stored Procedures
Task 13:
• Create a trigger that logs all grade changes in an AuditLog table.
Task 14:
• Write a stored procedure that generates a student’s transcript (list of courses
and grades).