![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Composite Key in RDBMS
A primary key having two or more attributes is called composite key. It is a combination of two or more columns.
An example can be −
Here our composite key is OrderID and ProductID −
{OrderID, ProductID} |
Let us see another example −
<Student>
StudentID | StudentEnrollNo | StudentMarks | StudentPercentage |
S001 | 0721722 | 570 | 90 |
S002 | 0721790 | 490 | 80 |
S003 | 0721766 | 440 | 86 |
Above, our composite keys are StudentID and StudentEnrollNo. The table has two attributes as primary key.
Therefore, the Primary Key consisting of two or more attribute is called Composite Key.
Advertisements