Keys in DBMS

Keys in DBMS

What are Keys in DBMS? 

Keys are an essential component of a relational database; they are used to establish and discover relationships between tables, as well as to uniquely identify any file or row of information within a table. 

In this article , we will learn about Keys in DBMS.

Keys in DBMS?

Keys Identify any given tuple or record uniquely and also provide necessary functionality between various tables, in sql there are various types of keys, some of which are –

  • Primary Key
  • Foreign Key
  • Candidate Key
  • Super Key
  • Alternate Key
  • Composite Key

We also use keys as they surely help us in enforcing identity & integrity in the relationship.

Let’s have a look further to understand how each of them work –

Keys in DBMS

How Keys in DBMS work

For an explanation of how each of the keys is working, we will take the help of the following tables –

Student Table

Student_ID NAME PHONE AGE
1 Arya 9111122222 21
2 Bran 9000012121 19
3 Jon 1234567890 24
4 Cersie 9876543210 24
5 Jamie 9988776655 24

Course Table

Student_ID COURSE_ID NAME
1 ECE101 Basic Electronics
2 CSE101 C++
3 CSE101 C++
4 EEE101 Basic Electrical
5 CSE201 DBMS

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription