Prime Attributes in DBMS

Learn via video course
FREE
View all courses
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
by Srikanth Varma
1000
5
Start Learning
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
by Srikanth Varma
1000
5
Start Learning
Topics Covered

An attribute in a database management system (DBMS) is a feature that refers to a database component, such as a table. It could also refer to a database field. Attributes describe the occurrences in a database column.

Prime attributes in DBMS

  • A prime attribute is one of the attributes that make up the candidate key. In addition to being called prime attributes, key attributes is another name for this type of attribute. It is also present in all of the candidate keys.
  • A set of attributes that uniquely identify tuples in a table is known as a Candidate Key. Candidate Key is a super key with no attributes that are repeated.
  • They are key attributes because they can be used to uniquely identify any of the table's records.

Non-prime attributes in DBMS

  • Non-prime attributes are those attributes of the relationships that are not present in any of the possible candidate keys of the relation.
  • They are also known as non-key attributes. A primary key is an attribute or group of attributes used to uniquely identify any record in a table. The values of a primary key cannot be duplicated.
  • Non-prime (non-key) attributes are those that are not the primary key attributes. They can store a value an unlimited number of times. They are non-key attributes because they cannot be used to uniquely identify any of the table's records.

For Example, take a look at the following queries :

As RegNo is the primary key in the Student table, the initial query will return either a zero or one result (if 12345 is a registered number). Name is not a primary key. As a result, the second query will return all records with the name Kumar in them.

Example Of Prime Attribute In DBMS

Consider the following table :

EMP_IDNAMESALARYDESIGNATIONDEPT_NO
666Smith12,000Clerk10
679Stefan50,000Bussiness Analyst40
685Yash84,600Manager40
691john12,000Clerk10
702Aditi18,000Salesman10
714Aditya47,000HR Analyst30
Column NameDescription
EMP_ID:As each individual will have a unique ID, it is considered a prime attribute.
NAME:As two people with the same name can exist, it is considered a non-prime attribute.
SALARY:As two people can have the same salary, it is a non-prime attribute.
DESIGNATION:As two different people may have the same designation, it is a non-prime attribute.
DEPT_NO:As two different persons with different designations can have the same department, it is a non-prime attribute.

Example Of Non-Prime Attribute In DBMS

Consider the following table :

STUDENT_IDNAMEAGECITYPHONE_NO
66Aditya21Noida9535653232
67Shivam22Gurugram8353355366
68Yash19Jaipur7323598665
69Mohit23Lahore8656864365
70Aditi24Noida8786898665
71Aditya22Jodhpur6532324365
Column NameDescription
STUDENT_ID:As each individual will have a unique ID,  it is a prime attribute.
NAME:As two people with the same name can exist, it is considered a non-prime attribute.
AGE:As two people can have the same age, it is a non-prime attribute.
CITY:As two different people may live in the same city, it is a non-prime attribute.
PHONE_NO:As no two persons will have the same phone number, it is a prime attribute.

Difference Between Prime And Non-Prime Attributes

Prime AttributesNon-Prime Attributes
Prime attributes can be used to uniquely identify a tuple in the table because they have unique values.Non-prime attributes can not be used to uniquely identify a tuple in the table because they can have the same values.
Prime Attributes are also known as Key Attributes.Non-Prime attributes are often known as Non-key attributes.
For Example:- Registration number and ID number will be prime attributes in a schema because every person will have a unique ID and registration number.For Example - Name and age will be non-prime attributes in a schema because any person can have the same name and age.

Conclusion

  1. Prime attributes are essential components of candidate keys in a database table, uniquely identifying each tuple.
  2. They are also referred to as key attributes and are present in all candidate keys.
  3. Conversely, non-prime attributes do not uniquely identify tuples and are not part of candidate keys.
  4. While prime attributes ensure uniqueness, non-prime attributes can have duplicate values.
  5. Understanding the distinction between prime and non-prime attributes is crucial for effective database design and querying.

Read More: