Open In App

Tuple in DBMS

Last Updated : 21 Mar, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Pre-requisites: Introduction of DBMS

A tuple, also known as a record or row, is a basic unit of data in a relational database management system (DBMS). A tuple represents a single instance of a relation, or table, in the database. Each tuple contains a set of values, or attributes, that correspond to the columns, or fields, of the relation. 

E.F. Codd invented the Relational Database Management System where he defined relationships as a collection of unique tuples. The relational model uses unique keys to organize data into at least one table of rows and columns. These rows can be depicted as Tables.

A tuple in a database management system is one record in the context of relational databases (one row). You can compare the data present in the database with a spreadsheet, with rows (known as tuples) and columns (known as fields or attributes) representing various data types. 

In DBMS, a unique key is assigned to each table that is used to organize and identify the elements. This key is known as the table’s primary key and is unique for each record present. In DBMS, the user can add a column containing the value from another table’s column. This enables the user to link the tuple of different tables.

The rows in the tables represent the records in the database, and the columns represent the attributes associated with the entity.

Working with Tuple in DBMS

In a relational database, a relation is defined by a set of attributes and a set of tuples that have values for those attributes.

Example:

A relation called “CUSTOMER” might have attributes such as “customer_id”, “first_name”, “last_name”, and “email”. Each tuple in the relationship would have a unique value for the “customer_id” attribute and corresponding values for the other attributes, such as “John” for “first_name” and “Smith” for “last_name”.

CUSTOMER Table

customer_id

first_name

last_name

email

1

John

Smith

abc@gmail.com

2

Abhishek

Bhosle

cde@gmail.com

3

Natasha

Witch

fgh@gmail.com

Tuples are also used in the process of normalization in a relational database. Normalization is the process of organizing data in a database to minimize data redundancy and improve data integrity. In the process of normalization, a relation is broken down into multiple smaller relations, each with a specific purpose and containing a specific set of attributes and tuples.

Example

In an un-normalized relation, an “ORDER” relation may include attributes such as “order_id”, “customer_id”, “product_id”, and “quantity”. In the process of normalization, the relation may be broken down into two separate relations, one called “orders” containing attributes such as “order_id” and “customer_id”, and another called “order_details” containing attributes such as “product_id” and “quantity”.

ORDER Table

order_id customer_id product_id quantity
A 1 AAA1 5
B 2 BBB1 6
C 3 CCC1 7

Tuples are also used in the process of querying a relational database. Queries are used to retrieve specific data from the database, and the result of a query is a set of tuples that match the criteria specified in the query. For example, a query to retrieve the first and last names of customers with a specific email address would return a set of tuples with those attributes for each customer that matches the criteria.

Types of Tuples

There are two types of tuples in a database management system:

  • Physical Tuples: Physical Tuples are the actual data stored in the storage media of a database. It is also known as a record or row.
  • Logical Tuples: Logical Tuples are the data representation in memory, where data is temporarily stored before being written to disk or during a query operation.

Both physical and logical tuples have the same attributes, but their representation and usage can differ based on the context of the operation.

Conclusion

In conclusion, a tuple is a basic unit of data in a relational database management system. It represents a single instance of a relation and contains a set of values that correspond to the attributes of that relation. Tuples are used in the process of normalization, as well as querying a relational database, to retrieve specific data. They play a vital role in organizing and structuring data in a database, improving data integrity, and making data retrieval easy.

FAQs

1. What are the Attributes of DBMS?

In Database Management System, Attributes are the properties or characteristics reflected by each entity of the entity set. 

For more, refer to the article: https://www.geeksforgeeks.org/types-of-attributes-in-er-model/ 

2. Can we have duplicates in Tuples?

Yes, Tuples allows duplicate members. Duplicate elements are not allowed in Primary Keys

3. How can you uniquely identify a tuple in the relation?

You can easily identify a tuple in relation with the help of Primary Key.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads