← RGPV CS-502 DBMS December 2024 solved question paper
← RGPV CS-502 DBMS December 2020 solved question paper
← RGPV CS-502 DBMS June 2025 solved question paper
RGPV Previous Year Examination Question
B.Tech. V Semester | CS-502 (GS) | December 2024 | 3(a)
Question (restated): Describe the different key constraints used in databases in detail.
Answer
Definition
Keys are attributes or sets of attributes used to identify tuples and establish relationships between relations. Key constraints maintain entity integrity and referential integrity by preventing ambiguous identification and invalid references.
Types of keys
Super key: Any attribute set that uniquely identifies a tuple. If RollNo is unique, both {RollNo} and {RollNo, Name} are super keys.
Candidate key: A minimal super key; removing any attribute destroys its uniqueness guarantee. If both RollNo and Email are independently unique and mandatory, each is a candidate key.
Primary key: The candidate key selected as the principal identifier. It must be unique and cannot contain NULL.
Alternate key: A candidate key not chosen as the primary key. Email can be an alternate key when RollNo is primary.
Composite key: A key containing multiple attributes. In Enrollment, the pair (RollNo, CourseID) identifies a student’s enrollment in a course.
Foreign key: An attribute set referencing a candidate or other permitted unique key in another or the same relation. It prevents references to nonexistent records, subject to NULL and referential-action rules.
SQL example
CREATE TABLE Department ( DeptID INT PRIMARY KEY, DeptName VARCHAR(50) ); CREATE TABLE Student ( RollNo INT PRIMARY KEY, Email VARCHAR(100) UNIQUE NOT NULL, Name VARCHAR(50), DeptID INT REFERENCES Department(DeptID) );
If Department contains IDs 10 and 20, a student referencing department 30 is rejected. Inserting another student with an existing RollNo or Email is also rejected. A NULL DeptID is allowed here because the relationship is optional.
Integrity constraints
Entity integrity requires every primary key value to be non-NULL. Referential integrity requires a non-NULL foreign key to match a referenced key. Domain constraints restrict values to valid types and ranges, for example CHECK (Marks BETWEEN 0 AND 100). Together these constraints maintain reliable and consistent database records.
Further reading
Silberschatz, Korth and Sudarshan, Database System Concepts; Elmasri and Navathe, Fundamentals of Database Systems.
December 2020 examination question
Write a note on different database keys.
A superkey uniquely identifies tuples; a candidate key is a minimal superkey. A primary key is the selected candidate key and cannot contain NULL values. Alternate keys are candidate keys not selected as primary. A composite key contains multiple attributes. A foreign key references a candidate or otherwise declared unique key in another or the same relation, subject to SQL constraints. A surrogate key is an artificial identifier, while a natural key has business meaning. For Student(ID,Email,DeptID), ID and Email may be candidate keys if both are unique and non-null; ID can be primary and DeptID can reference Department. Keys enforce entity and referential integrity.
Further reading: Silberschatz, Korth and Sudarshan, Database System Concepts.
June 2025 – Q4(a)
Explain superkeys and their relationship to candidate and primary keys.
A superkey uniquely identifies each tuple. A candidate key is a minimal superkey: removing any attribute destroys uniqueness. A primary key is one selected candidate key. For Student(Sid,Email,Name), if Sid and Email are independently unique and non-null, {Sid}, {Email} and {Sid,Name} are superkeys, but only the first two are candidate keys. Choosing Sid as primary key leaves Email as an alternate key. Minimality means set inclusion, not necessarily minimum cardinality across all keys.
https://easyexamnotes.com/wp-content/uploads/2026/12/database-key-constraints-jun2025.png
← RGPV CS-502 DBMS December 2024 solved question paper
Discussion
Ask a question, share your thoughts or report an error.
Sign in to participate in the discussion.
Join the discussion