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

Overview

A database, also known as the backend, is an essential component of every Enterprise Web Application. As a result, it appears to have been tested for functionality and performance.

A Structured Query Language is required to access or alter a database (SQL). It is a database programming language that allows us to work with many databases such as Oracle, MYSQL, and SQL Server .

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.

Introduction

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 do 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

  • A prime attribute is an attribute that is part of any candidate key. It can also be used to uniquely identify a tuple in the schema. A prime attribute in DBMS is also known as a key attribute.
  • A non-prime attribute is one that is not part of one of the candidate keys. It cannot be used to uniquely identify a tuple in the schema. A non-prime attribute in DBMS is also known as a non-key attribute.

Read More: