Skip to main content

Posts

Showing posts from February, 2021

Difference between Super, Candidate, Primary & Unique keys.

  Difference between Super Key and  Candidate Key Last Updated: 23-02-2021 Super Key: Super Key is an attribute (or set of attributes) that is used to uniquely identifies all attributes in a relation. All super keys can’t be candidate keys  but its reverse is true. In relation, the number of super keys is more than the  number of candidate keys. Example: We have a given relation R(A, B, C, D, E, F) and we shall check for being  super keys by following given dependencies: Functional  dependencies                Super key AB->CDEF                                      YES CD->ABEF                                      YES CB->DF                            ...

Difference between Primary Key , Foreign Key & Candidate Key

 Last Updated: 23-02-2021 Primary Key: A primary key is used to ensure data in the specific column is unique. It is a column that cannot have NULL values. It is either an existing table column or a column that is specifically generated by the database according to a defined sequence. Example: Refer to the figure – STUD_NO, as well as STUD_PHONE both, are candidate keys for relation STUDENT but STUD_NO can be chosen as the primary key (only one out of many candidate keys). Foreign Key: A foreign key is a column or group of columns in a relational database table that provides a link between data in two tables. It is a column (or columns) that references a column (most often the primary key) of another table. Example: Refer to the figure – STUD_NO in STUDENT_COURSE is a foreign key to STUD_NO in STUDENT relation. Figure: Let’s see the difference between Primary Key and Foreign Key: PRIMARY KEY A primary key is used to ensure data in the specific column is unique. It uniquely identifie...