There are majorly seven types of keys in the database. Let us discuss them in more detail as below.  Candidate Key: A candidate key shows a set of properties that can uniquely identify a table. Each table can have more than one candidate key. One key out of all candidate keys can be selected as the primary key. For example, studentId and firstName can be considered candidate keys because they can uniquely identify each tuple.   Super Key: A super key defines a set of attributes that can uniquely identify a tuple. Candidate keys and primary keys are subsets of super keys. So, the super key is a superset of them.   Primary Key: A primary key defines a set of attributes used to uniquely identify each tuple. For example, studentId and firstName are candidate keys and either can be selected as the primary key. Here, studentId is the primary key.  Unique Key: A unique key is very similar to a primary key, except that a primary key does not allow null values in a column, whereas a unique key does. So, the unique key is basically the primary key with its NULL values.  Alternate Keys: All candidate keys not selected as primary keys are considered alternate keys. In the example, firstname and lastname are alternate keys in the database.  Foreign Key: A foreign key defines an attribute that can only retrieve values that exist in one table, along with attributes that exist in another table. In the example, courseId in the Student table is a foreign key to the Course table because both tables contain courseId as one of their attributes.   Composite Key: A composite key refers to the combination of two or more columns that can uniquely identify each tuple in a table. In the example, we can group studentId and firstname to uniquely identify each tuple in the table.  Expect to come across this popular DBMS viva question, as this tests your basic concepts.