DBMS Lab 5 Tasks
DBMS Lab 5 Tasks
LAB 05
SQL AGGREGATE FUNCTIONS,
SUB-QUERIES
The objective of this lab is to design and implement a relational database using PostgreSQL, and to practice
writing SQL queries to retrieve and manipulate data. You will work with three tables: Student, Courses, and
Enrollment. The goal is to understand relationships between tables, enforce data integrity, and generate
meaningful queries.
Tables Description:
1. Student Table:
o SID (Primary Key): Unique identifier for each student.
o SNAME: Name of the student.
o Faculty: Faculty or department the student belongs to.
2. Courses Table:
o CID (Primary Key): Unique identifier for each course.
o CNAME: Name of the course.
o CreditHour: Number of credit hours for the course.
3. Enrollment Table:
o CID (Foreign Key): References the Courses table.
o SID (Foreign Key): References the Student table.
o Semester: Semester in which the student is enrolled (e.g., Fall, Spring).
Sample Data: