In SQL, index and key both are different. Even though both look same, in reality both works differently in RDBMS of any relational database. Index is one kind of relational database object, where as Key is different and it maintains relation between different tables. Explained in my previous post about features of RDBMS
Indexes are many types. Functions of each index and its benefits explained to understand quickly.
Differences of Index and Key…
The benefits of Index are
To improve query performance. Indexes can be used to access the data faster using direct access to rows based on the index key values.
To guarantee uniqueness when they are defined as unique indexes
A Key can be a single column or multiple columns of a table. You can find different key are available in relational database
The benefits of Key
- Keys are important in a relational database because they ensure that each record in a table is uniquely identified, they help establish and enforce referential integrity, and they establish relationships between tables.
- The same column can be part of more than one key
DB2 user group
- DB2 UDF sample function read now with awesome interview question
- Real reason why Left outer JOIN only you need to use in DB2 SQL
- 3 top rules to write alias instead of Table column name in SQL query