Indian Institute of Information Technology Vadodara
Government Engineering College, Sector 28 GIDC, Gandhinagar, Gujarat
Assignment - 2
Database Management Systems (DBMS) - CS262
Relational Algebra Operations
Problem Statement
Tasks
1. Create Table: Create a table student details with the following columns:
• student id (5 characters)
• student name (up to 30 characters)
• department (up to 20 characters)
• cgpa (up to 4.2 format, e.g., 9.2)
Insert the following records into the table:
• (S101, Aditi, Computer Science, 8.9)
• (S102, Ravi, Mechanical, 7.5)
• (S103, Priya, Civil, 8.7)
• (S104, Arjun, Electrical, 8.0)
• (S105, Neha, IT, 9.1)
2. SELECT Operation:
(a) Retrieve the details of all students with a CGPA greater than 8.0.
(b) Retrieve the names of students who belong to the Civil department.
(c) Find the details of the student with student id = S102.
3. PROJECT Operation:
(a) Retrieve only the names and CGPAs of all students.
(b) Retrieve only the department names without any duplicates.
4. Create Another Table: Create a table course details with the following columns:
• course id (5 characters)
• course name (up to 25 characters)
• department (up to 20 characters)
Insert the following records into the table:
1
• (C101, Algorithms, Computer Science)
• (C102, Thermodynamics, Mechanical)
• (C103, Concrete Structures, Civil)
• (C104, Circuit Analysis, Electrical)
• (C105, Cyber Security, IT)
5. Cartesian Product: Write a query to combine student details and course details
using Cartesian Product. Show only the first 5 rows of the resulting table.
6. Rename Operation:
(a) Rename the student details table to students info.
(b) Rename the course details table to courses info.
(c) Display the first 5 rows of both renamed tables.
7. Natural Join:
(a) Perform a natural join between student details and course details based
on the department column and display the following:
• student name, course name, and department.
(b) List the courses taken by students in the IT department.
8. Combining Operations:
(a) Using SELECT, PROJECT, and NATURAL JOIN, find the names of students
and the courses they are eligible for.
(b) Find all departments that have both students and courses using NATURAL
JOIN.