Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Unit 1: Keys in Depth

Lesson 8 of 28 in the free Database Management Systems notes on Siksha Sarovar, written by Rohit Jangra.

8.1 The Importance of Keys

In a database, we must be able to distinguish one entity from another. Keys are attributes that allow us to uniquely identify a record.

8.2 Types of Keys

1. Super Key

A set of one or more attributes that, taken collectively, allow us to identify uniquely an entity in the entity set.

  • Example: For a Student, {Roll_No}, {Roll_No, Name}, and {Email, Phone} are all Super Keys.

2. Candidate Key

A "Minimal" Super Key. A super key for which no proper subset is also a super key.

  • Example: If {Roll_No} is enough to identify a student, then {Roll_No, Name} is a super key but not a candidate key (because {Roll_No} is a subset).
  • A table can have multiple Candidate Keys (e.g., Roll_No and Email).

3. Primary Key

One of the Candidate Keys chosen by the database designer to be the principal means of identifying entities.

  • Rules for Primary Key:
  1. Must be unique.
  2. Cannot be NULL.
  3. Should be stable (values shouldn't change often).
  • Notation: Underlined in ER diagrams.

4. Composite Key

A primary key that consists of more than one attribute.

  • Example: In an Enrollment table, the combination of {Student_ID, Course_ID} might be the key.

5. Foreign Key

An attribute in one table that refers to the Primary Key of another table. It is used to create a link between two tables.