What Is a Compound Key

The significance of database is known to everyone and how it has changed our world over the years. Database consists of many predefined data structures which stores data. However, there were many loop holes in the beginning and with time software engineers found a system to store correlated data or data with some significance. This system was called Relational Database Management System or RDBMS.

A proper RDBMS consists of a table or relation, attributes or columns, and record or tuples. RDBMS consists of three different language, data definition language, data manipulation language, and a query language popularly known as SQL. All such languages are used to reduce various anomalies especially data redundancy. This lead to the use of simple key, compound key, primary and foreign keys etc. Every attributes is a simple key and when this simple comprises of two or more attributes than it is termed as compound key. One can say the combination of foreign and primary key is a compound key.

Understanding the term: Compound Key   

Lets take a relation say employees, where we have attributes such as employee_id, employee name, department etc. Lets have a look at the relationship between any two attributes, employees_id and department. Both employees-id and department are related to each other and have two attributes or simple keys, employees number and corresponding department number. Thus this relation has a compound key in the form of employees number and department number. Compound key is nothing but an amalgamation of two or more simple keys related to each other in a relation. Every output or result of a SQL statement is a Compound key. SQL statements such as joins and selection of two or more attribute from a relation is a compound key in that particular table.

Facts about compound key

Compound key is not a composite key. These two are two different keys in RDBMS. However, the difference is negligible between the two. Yet, people use these terms interchangeably and some say, practically there is not much difference between the two. Theoretically, there is a difference between the two as a composite key consists of two or more attributes which uniquely define  the occurrence of an entity in the entity relationship model. These attributes can be anything from simple keys to values. So, there lies the difference as compound keys is composed of simple keys and not values.      

If Oracle SQL has a term named compound key then it holds a lot of significance, especially in understanding the basics of RDBMS. Theoretically, no body can deny the use of compound key as every output itself is a compound key. Yet, in real time implementation of SQL, one can overlook such minute term of RDBMS.

admin