SlideShare a Scribd company logo
1 of 5
Download to read offline
What are Keys?
A DBMS key is an attribute or set of an attribute which helps us to identify a row(tuple) in a relation(table).
They allow you to find the relation between two tables. Keys help us uniquely identify a row in a table by a
combination of one or more columns in that table.
Super Key
Super Key is defined as a set of attributes within a table that can uniquely identify each record within a
table.
Let's take a simple Student table, with fields student_id, name, phone and age.
In the table defined above super key would include student_id, (student_id, name), phone etc.
Candidate Key
The candidate keys in a table are defined as the set of keys that is minimal and can uniquely identify any
data row in the table.
In our example, student_id and phone both are candidate keys for table Student.
 A candiate key can never be NULL or empty. And its value should be unique.
 There can be more than one candidate keys for a table.
 A candidate key can be a combination of more than one columns(attributes).
Primary Key
Primary key is a candidate key that is most appropriate to become the main key for any table. It is a key
that can uniquely identify each record in a table.
The Primary Key in <Subject> table is {Subject_Number}
Foreign Key
Foreign keys are the columns of a table that points to the primary key of another table. They act as a cross-
reference between tables.
Student ExamResult
Example
The Super Keys in <Student> table are:
{Student_Number}
{Student_Phone}
{Student_Number,Student_Name}
{Student_Number,Student_Phone}
{Student_Number,Subject_Number}
{Student_Phone,Student_Name}
{Student_Phone,Subject_Number}
{Student_Number,Student_Name,Student_Phone}
{Student_Number,Student_Phone,Subject_Number}
{Student_Number,Student_Name,Subject_Number}
{Student_Phone,Student_Name,Subject_Number}
The Candidate Key in <Student> table is {Student_Number} or {Student_Phone}
The Candidate Key in <Student> table is {Student_Number, Subject_Number}
The Primary Key in <Student> table is {Student_Number}
{Subject_Number} is the Foreign Key of <Student> table and Primary key of <Subject> table.
Comparison between Primary key and Foreign Key
BASIS FOR
COMPARISON
PRIMARY KEY FOREIGN KEY
Basic Primary Key is a chosen candidate key
that uniquely defines a tuple in a
relation.
Foreign key in a table refers to the primary
key of other table.
NULL Primary key value can never be NULL. Foreign key accepts NULL value.
Range There can be only one primary key of a
relation.
There can be multiple foreign keys in a
relation.
Insertion We can insert a value to a primary key
attribute, even if the referencing foreign
key does not have that value in its
column.
We can not insert a value to a foreign key,
if that value is not present in the referenced
primary key column.
Deletion Before you delete a primary key value,
make sure that value is not still present
in the referencing foreign key column of
referencing table.
You can delete a value from foreign key
column without bothering, whether that
value is present in referenced primary key
column of referenced relation.
Difference between Super Key and Candidate Key
S.NO SUPER KEY CANDIDATE KEY
1.
Super Key is an attribute (or set of
attributes) that is used to uniquely identifies
all attributes in a relation.
Candidate Key is a proper subset of
a super key.
2. All super keys can’t be candidate keys.
But all candidate keys are super
keys.
3.
Various super keys together makes the
criteria to select the candidate keys.
Various candidate keys together
makes the criteria to select the
primary keys.
4.
In a relation, number of super keys are more
than number of candidate keys.
While in a relation, number of
candidate keys are less than number
of super keys.
5.
Super key’s attributes can contain NULL
values.
Candidate key’s attributes can also
contain NULL values.
A. S. M. Shafi
Lecturer
Department of Computer Science and Engineering
Khwaja Yunus Ali University
Enaytpur, Sirajgonj-6751, Bangladesh

More Related Content

What's hot

Slide 5 keys
Slide 5 keysSlide 5 keys
Slide 5 keysVisakh V
 
Natural vs.surrogate keys
Natural vs.surrogate keysNatural vs.surrogate keys
Natural vs.surrogate keysRon Morgan
 
Key and its different types
Key and its different typesKey and its different types
Key and its different typesUmair Shakir
 
Relational keys
Relational keysRelational keys
Relational keysSana2020
 
Database management system
Database management systemDatabase management system
Database management systemyash patel
 
Keys in Database Management System
Keys in Database Management SystemKeys in Database Management System
Keys in Database Management SystemAnkit Rai
 
Keys presentation
Keys presentationKeys presentation
Keys presentationmubeenkiran
 
2.2 keys
2.2 keys2.2 keys
2.2 keysELIMENG
 
Relational model
Relational modelRelational model
Relational modelJihin Raju
 
Key-Database Management
Key-Database Management Key-Database Management
Key-Database Management Bikash Sapkota
 
The Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database ConstraintsThe Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database Constraintssontumax
 
Relational database intro for marketers
Relational database intro for marketersRelational database intro for marketers
Relational database intro for marketersSteve Finlay
 
ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...Raj vardhan
 

What's hot (18)

Slide 5 keys
Slide 5 keysSlide 5 keys
Slide 5 keys
 
Natural vs.surrogate keys
Natural vs.surrogate keysNatural vs.surrogate keys
Natural vs.surrogate keys
 
Key and its different types
Key and its different typesKey and its different types
Key and its different types
 
Database Keys
Database KeysDatabase Keys
Database Keys
 
DBMS Keys
DBMS KeysDBMS Keys
DBMS Keys
 
Relational keys
Relational keysRelational keys
Relational keys
 
Database management system
Database management systemDatabase management system
Database management system
 
Keys in Database Management System
Keys in Database Management SystemKeys in Database Management System
Keys in Database Management System
 
Kul 2
Kul 2Kul 2
Kul 2
 
Keys presentation
Keys presentationKeys presentation
Keys presentation
 
2.2 keys
2.2 keys2.2 keys
2.2 keys
 
Key
KeyKey
Key
 
Relational model
Relational modelRelational model
Relational model
 
Plsqlobj
PlsqlobjPlsqlobj
Plsqlobj
 
Key-Database Management
Key-Database Management Key-Database Management
Key-Database Management
 
The Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database ConstraintsThe Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database Constraints
 
Relational database intro for marketers
Relational database intro for marketersRelational database intro for marketers
Relational database intro for marketers
 
ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...
 

Similar to Keys in Database

Similar to Keys in Database (20)

SQL_DBMS_KEYS.pptx
SQL_DBMS_KEYS.pptxSQL_DBMS_KEYS.pptx
SQL_DBMS_KEYS.pptx
 
B & c
B & cB & c
B & c
 
Dbms keys
Dbms keysDbms keys
Dbms keys
 
Doc 20191022-wa0041
Doc 20191022-wa0041Doc 20191022-wa0041
Doc 20191022-wa0041
 
Key in DatabaseManagementSystem_engineering.pptx
Key in DatabaseManagementSystem_engineering.pptxKey in DatabaseManagementSystem_engineering.pptx
Key in DatabaseManagementSystem_engineering.pptx
 
computer-210809080138.pdf
computer-210809080138.pdfcomputer-210809080138.pdf
computer-210809080138.pdf
 
key (1).pptx
key (1).pptxkey (1).pptx
key (1).pptx
 
Keys.pptx
Keys.pptxKeys.pptx
Keys.pptx
 
Dbms keysppt
Dbms keyspptDbms keysppt
Dbms keysppt
 
Keys used in database
Keys used in databaseKeys used in database
Keys used in database
 
Dbms keys
Dbms keysDbms keys
Dbms keys
 
Keys in DBMS
Keys in DBMSKeys in DBMS
Keys in DBMS
 
Intro to Data warehousing lecture 12
Intro to Data warehousing   lecture 12Intro to Data warehousing   lecture 12
Intro to Data warehousing lecture 12
 
key.pptx
key.pptxkey.pptx
key.pptx
 
DBMS-Keys , Attributes and Constraints.pptx
DBMS-Keys , Attributes and Constraints.pptxDBMS-Keys , Attributes and Constraints.pptx
DBMS-Keys , Attributes and Constraints.pptx
 
DBMS key topic Presentation slide 1.pptx
DBMS key topic Presentation slide 1.pptxDBMS key topic Presentation slide 1.pptx
DBMS key topic Presentation slide 1.pptx
 
ISDD Database Keys N5
ISDD Database Keys N5ISDD Database Keys N5
ISDD Database Keys N5
 
Presentation OF DBMS-2.pptx
Presentation OF DBMS-2.pptxPresentation OF DBMS-2.pptx
Presentation OF DBMS-2.pptx
 
Whats the Schema Table Column Row Attribute Entity Pri.pdf
Whats the Schema  Table  Column  Row  Attribute  Entity  Pri.pdfWhats the Schema  Table  Column  Row  Attribute  Entity  Pri.pdf
Whats the Schema Table Column Row Attribute Entity Pri.pdf
 
DBMS Unit 2 ppt.ppt
DBMS Unit 2 ppt.pptDBMS Unit 2 ppt.ppt
DBMS Unit 2 ppt.ppt
 

More from A. S. M. Shafi (20)

2D Transformation in Computer Graphics
2D Transformation in Computer Graphics2D Transformation in Computer Graphics
2D Transformation in Computer Graphics
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphics
 
Projection
ProjectionProjection
Projection
 
2D Transformation
2D Transformation2D Transformation
2D Transformation
 
Line drawing algorithm
Line drawing algorithmLine drawing algorithm
Line drawing algorithm
 
Fragmentation
FragmentationFragmentation
Fragmentation
 
File organization
File organizationFile organization
File organization
 
Bankers algorithm
Bankers algorithmBankers algorithm
Bankers algorithm
 
RR and priority scheduling
RR and priority schedulingRR and priority scheduling
RR and priority scheduling
 
Fcfs and sjf
Fcfs and sjfFcfs and sjf
Fcfs and sjf
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
 
1D Array
1D Array1D Array
1D Array
 
2D array
2D array2D array
2D array
 
Stack push pop
Stack push popStack push pop
Stack push pop
 
Queue
QueueQueue
Queue
 
Searching
SearchingSearching
Searching
 
Sorting
SortingSorting
Sorting
 
Linked list
Linked listLinked list
Linked list
 
Sum of subset problem
Sum of subset problemSum of subset problem
Sum of subset problem
 
Quick sort
Quick sortQuick sort
Quick sort
 

Recently uploaded

Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...Call Girls in Nagpur High Profile
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 

Recently uploaded (20)

Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 

Keys in Database

  • 1. What are Keys? A DBMS key is an attribute or set of an attribute which helps us to identify a row(tuple) in a relation(table). They allow you to find the relation between two tables. Keys help us uniquely identify a row in a table by a combination of one or more columns in that table. Super Key Super Key is defined as a set of attributes within a table that can uniquely identify each record within a table. Let's take a simple Student table, with fields student_id, name, phone and age. In the table defined above super key would include student_id, (student_id, name), phone etc. Candidate Key The candidate keys in a table are defined as the set of keys that is minimal and can uniquely identify any data row in the table. In our example, student_id and phone both are candidate keys for table Student.  A candiate key can never be NULL or empty. And its value should be unique.  There can be more than one candidate keys for a table.  A candidate key can be a combination of more than one columns(attributes). Primary Key Primary key is a candidate key that is most appropriate to become the main key for any table. It is a key that can uniquely identify each record in a table. The Primary Key in <Subject> table is {Subject_Number}
  • 2. Foreign Key Foreign keys are the columns of a table that points to the primary key of another table. They act as a cross- reference between tables. Student ExamResult
  • 3. Example The Super Keys in <Student> table are: {Student_Number} {Student_Phone} {Student_Number,Student_Name} {Student_Number,Student_Phone} {Student_Number,Subject_Number} {Student_Phone,Student_Name} {Student_Phone,Subject_Number} {Student_Number,Student_Name,Student_Phone} {Student_Number,Student_Phone,Subject_Number} {Student_Number,Student_Name,Subject_Number} {Student_Phone,Student_Name,Subject_Number} The Candidate Key in <Student> table is {Student_Number} or {Student_Phone} The Candidate Key in <Student> table is {Student_Number, Subject_Number} The Primary Key in <Student> table is {Student_Number}
  • 4. {Subject_Number} is the Foreign Key of <Student> table and Primary key of <Subject> table. Comparison between Primary key and Foreign Key BASIS FOR COMPARISON PRIMARY KEY FOREIGN KEY Basic Primary Key is a chosen candidate key that uniquely defines a tuple in a relation. Foreign key in a table refers to the primary key of other table. NULL Primary key value can never be NULL. Foreign key accepts NULL value. Range There can be only one primary key of a relation. There can be multiple foreign keys in a relation. Insertion We can insert a value to a primary key attribute, even if the referencing foreign key does not have that value in its column. We can not insert a value to a foreign key, if that value is not present in the referenced primary key column. Deletion Before you delete a primary key value, make sure that value is not still present in the referencing foreign key column of referencing table. You can delete a value from foreign key column without bothering, whether that value is present in referenced primary key column of referenced relation.
  • 5. Difference between Super Key and Candidate Key S.NO SUPER KEY CANDIDATE KEY 1. Super Key is an attribute (or set of attributes) that is used to uniquely identifies all attributes in a relation. Candidate Key is a proper subset of a super key. 2. All super keys can’t be candidate keys. But all candidate keys are super keys. 3. Various super keys together makes the criteria to select the candidate keys. Various candidate keys together makes the criteria to select the primary keys. 4. In a relation, number of super keys are more than number of candidate keys. While in a relation, number of candidate keys are less than number of super keys. 5. Super key’s attributes can contain NULL values. Candidate key’s attributes can also contain NULL values. A. S. M. Shafi Lecturer Department of Computer Science and Engineering Khwaja Yunus Ali University Enaytpur, Sirajgonj-6751, Bangladesh