0% found this document useful (0 votes)
2 views4 pages

Individual Advanced Database Laboratory Practical Assignment

This document outlines a practical assignment for Computer Science students at Ambo University, focusing on advanced database concepts. It includes tasks related to database setup, object-oriented schema design, query optimization, transaction management, concurrency control, backup and recovery, database security, distributed databases, and triggers and stored procedures. The assignment requires the use of Microsoft SQL Server or Oracle DB and emphasizes both coding and explanation of approaches.

Uploaded by

joshua211619
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 views4 pages

Individual Advanced Database Laboratory Practical Assignment

This document outlines a practical assignment for Computer Science students at Ambo University, focusing on advanced database concepts. It includes tasks related to database setup, object-oriented schema design, query optimization, transaction management, concurrency control, backup and recovery, database security, distributed databases, and triggers and stored procedures. The assignment requires the use of Microsoft SQL Server or Oracle DB and emphasizes both coding and explanation of approaches.

Uploaded by

joshua211619
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/ 4

AMBO UNIVERSITY

HACALU HUNDESA CAMPUS


SCHOOL OF INFORMATICS AND ELECTIRICAL ENGINEERING
DEPARTMENT OF COMPUTER SCIENCE

Advanced Database Laboratory - Practical


Assignment
Individual Work

Course Code: CoSc2042


Target Group: Computer Science 2nd Regular Student
Course Sem.: 2nd Semester May 8, 2025
Due Date: submission 8/5/2016 presentation 5/8/2025
Max Mark: 15
Assignment submission format: in hard copy and soft copy, the number of slides is not limited.

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)

o Courses (CourseID, Title, Credits)

o Enrollments (EnrollmentID, StudentID, CourseID, Grade)

• Insert at least 5 sample records into each table.


Task 2:
Write a query to:
• List all students in the "Computer Science" department.
• Find the average grade of each student.

2. Object-Oriented Database Concepts


Task 3:
• Design an object-oriented schema for a LibraryDB where:
o A Book is an object with properties (ISBN, Title, Author, Status).
o A Member is an object with properties (MemberID, Name, BorrowedBooks).
• Write an OQL query to find all books borrowed by a member named "John Doe."

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;

• Which performs better? Why?


4. Transaction Management
Task 6:
• Write a transaction that transfers a student from one course to another:
o Enroll in the new course.
o Remove from the old course.
o Roll back if the new course is full (assume a Capacity column in Courses).
Task 7:
• Create a stored procedure that updates a student’s grade, with:
o A savepoint before the update.
o Rollback if the grade is invalid (not between A-F).
5. Concurrency Control
Task 8:
• Simulate a lost update problem with two transactions:
o Transaction 1: Reads a student’s grade, adds 5 points, and updates.
o Transaction 2: Reads the same grade, subtracts 3 points, and updates.
• Fix it using locking.
Task 9:
• Implement optimistic concurrency control (using timestamps) to handle
concurrent updates on a student’s email.
6. Backup & Recovery
Task 10:
• Write SQL commands to:
o Take a full backup of UniversityDB.
o Simulate a crash and restore the database.
7. Database Security
Task 11:
• Create three roles: Admin, Professor, Student.
• Assign permissions:
o Admin can create/delete tables.

o Professor can update grades.

o Student can only view their own grades.

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).

You might also like