← RGPV CS-502 DBMS December 2024 solved question paper
← RGPV CS-502 DBMS December 2025 solved question paper
RGPV Previous Year Examination Question
B.Tech. V Semester | CS-502 (GS) | December 2024 | 7(b)(iii)
Question (restated): Briefly describe join operations.
Answer
Definition
A join combines related tuples from two relations according to a condition. It is essential for retrieving information distributed across normalized tables.
Illustrative relations
Student(ID, Name, DeptID): (1, Amit, 10), (2, Priya, 20), (3, Rahul, NULL) Department(DeptID, DeptName): (10, CSE), (20, IT), (30, ME)
Types of joins
An inner join returns only matching rows. An equijoin uses equality as its join condition; a theta join allows other comparison operators. A natural join matches identically named attributes and removes duplicate join columns. A left outer join retains all left rows, filling unmatched right attributes with NULL. A right outer join retains all right rows, and a full outer join retains unmatched rows from both sides. A cross join produces the Cartesian product. A self join joins a relation to itself using aliases.
SELECT S.Name, D.DeptName FROM Student S LEFT JOIN Department D ON S.DeptID = D.DeptID;
| Name | DeptName |
|---|---|
| Amit | CSE |
| Priya | IT |
| Rahul | NULL |
An inner join would omit Rahul; a full outer join would additionally include the unmatched ME department. A cross join of these two three-row relations produces nine rows. Explicit join conditions are generally preferable to natural joins when schema changes could introduce unintended matching columns.
Further reading
Silberschatz, Korth and Sudarshan, Database System Concepts; Elmasri and Navathe, Fundamentals of Database Systems.
December 2025 – Q8(b)
Question (restated): Demonstrate equi-join, outer join and a nested query using EXISTS.
Assume EMP(Eid, Ename, Dept) and DEPT(Dept, Dname), with Dept identifying a department. An equi-join matches rows using equality. An outer join retains unmatched rows from one or both inputs. EXISTS tests whether a subquery returns at least one row.
SELECT e.Ename, d.Dname FROM EMP e JOIN DEPT d ON e.Dept = d.Dept; SELECT e.Ename, d.Dname FROM EMP e LEFT JOIN DEPT d ON e.Dept = d.Dept; SELECT e.Ename FROM EMP e WHERE EXISTS (SELECT 1 FROM DEPT d WHERE d.Dept = e.Dept AND d.Dname = 'Sales');
Suppose EMP contains Asha in D1, Ravi in D2 and Neha with a null department; DEPT contains D1 Sales and D2 IT. The equi-join returns Asha–Sales and Ravi–IT. The left outer join additionally returns Neha with a null department name. The EXISTS query returns Asha only. A right outer join preserves all right-side rows; a full outer join preserves unmatched rows from both sides where supported by the DBMS.
The correlated subquery refers to e.Dept from the outer query. EXISTS does not require retrieving the actual subquery columns; SELECT 1 expresses the existence test. Unlike an ordinary join, EXISTS does not multiply outer rows when multiple inner rows satisfy the condition.
Discussion
Ask a question, share your thoughts or report an error.
Sign in to participate in the discussion.
Join the discussion