Category: Keys

  • Alternate Key

    The SQL Alternate Key SQL Alternate Keys in a database table are candidate keys that are not currently selected as a primary key. They can be used to uniquely identify a tuple(or a record) in a table. There is no specific query or syntax to set the alternate key in a table. It is just a column…

  • Composite Key

    The SQL Composite Key An SQL Composite Key is a key that can be defined on two or more columns in a table to uniquely identify any record. It can also be described as a Primary Key created on multiple columns. Composite Keys are necessary in scenarios where a database table does not have a single column…

  • Foreign Key

    The SQL Foreign Key In SQL, a Foreign Key is a column in one table that matches a Primary Key in another table, allowing the two tables to be connected together. A foreign key also maintains referential integrity between two tables, making it impossible to drop the table containing the primary key (preserving the connection between the…

  • Primary Key

    The SQL Primary Key The SQL Primary Key is a column (or combination of columns) that uniquely identifies each record in a database table. The Primary Key also speeds up data access and is used to establish a relationship between tables. Even though a table can only have one Primary Key, it can be defined on one…

  • Unique Key

    The SQL Unique Key The SQL Unique Key (or, Unique constraint) does not allow duplicate values in a column of a table. It prevents two records from having same values in a column. Unique Key is just an alternative to the Primary Key; as both Unique and Primary Key constraints ensure uniqueness in a column of the…