+ 1
what are different keys used in RDBMS? (e. g. )
2 odpowiedzi
+ 1
Types of keys in RDBMS:
1.Super Key: It is a set of attributes that uniquely identifies each row within a table.
It is a superset of candidate key.
A table can have many super keys.
e.g. for a table with id, name, address,class,
Super Keys can be: a)id
b)id,name
c)id,address
d)id,class
2. Candidate Key: It is a field or combination of fields to uniquely identify a row.
It is a minimal super key. It means minimum number of fields of a super key, which can uniquely identify the row.
for e.g: a) id
b) name, address
3. Primary Key: It is a candidate key.
It is used to uniquely identify a row.
for e.g: a)id
b)roll no.
4. Foreign Key: It points to the primary key of another table.
for e.g: We have two tables: First is Students table consisting of student_id, name, address, class, subject_id.
Another table is Subjects table has subject_id,name
so here subject_id(foreign key) in first table Students refers to the subject_id(primary key) in second table.
5.Composite key: If multiple attributes are used to create a primary key, then that primary key is called as Composite key.
for e.g: student_name, school_name
0
thanks