DBMS

SQL COMMAND.pdf

Key In DBMS

'

Key

A key is an attribute or set of attributes that helps in uniquely identifying a record from a table.

it's also used to establish and identify relationships between tables

image

Why do we need Keys?

1. Keys are used to establish and identify relationships between tables/relations.
2. They uniquely identify any record/row inside a table/relation.
3. They also ensure that data integrity is maintained.

Types of Keys ?

1. Super Key ---> If a set of one or more attributes can uniquely identify the entities of an entity set, then it is called a super key.
2. Candidate Key ---> Candidate keys are selected from a set of super keys. If a super key has no unnecessary attributes, then such a minimal super key is called a candidate key.
3. Primary Key ---> Primary keys are selected from a set of candidate keys. It is a candidate key selected by the database designer to uniquely identify the records of a table.

The primary key field of a table must be unique and cannot be null.
A table does not contain more than one primary key.

  1. Alternate Key ---> If a candidate key is not selected as a primary key then it is called an alternate key.

  1. Foreign Key ---> A foreign key is the one that is used to link two tables together via the primary key. It means the columns of one table points to the primary key attribute of the other table.


Normalization

Normalization is the process of minimizing redundancy from a relation or set of relations.



SQL

1. WAQ to bring all data from Customers Table.

What is meant by ACID properties in DBMS?