» » Primary key in database

Primary key in database

posted in: Information Technology | 0
Spread the love

What is Primary key?

The primary key is an attribute or a set of attributes that uniquely identify a specific instance of an entity. Every entity in the data model must have a primary key whose values uniquely identify instances of the entity.For example there are number of students in a class.There is a possibility for the students having same name.But the student’s unique RollNo will identify the particular student. So, RollNo is set to be the Primary Key of the STUDENT entity.

  • To qualify as a primary key for an entity, an attribute must have the following properties.
  • It must have a non-null value for each instance of the entity
  • The value must be unique for each instance of an entity
  • The values must not change or become null during the life of each entity instance.

What is an entity?

An entity is an object that are represented in the database. For example Ram,Gopi etc.An entity is represented or defined by set of attributes.

What are attributes?

Attributes are the properties used to describe an entity. For example, a STUDENT entity may have a Name, Roll number, Class, Marks etc. where STUDENT is the entity and name,roll number,class marks are the attributes.

 

Follow Iswarya:

Latest posts from

Leave a Reply