Relational Algebra | Database Management System (DBMS) - Computer Science Engineering (CSE) PDF Download

Introduction

Relational Algebra is procedural query language, which takes Relation as input and generate relation as output. Relational algebra mainly provides theoretical foundation for relational databases and SQL.

Operators in Relational Algebra

  1. Projection (π): Projection is used to project required column data from a relation.
    Example:Relational Algebra | Database Management System (DBMS) - Computer Science Engineering (CSE)Relational Algebra | Database Management System (DBMS) - Computer Science Engineering (CSE)Note: By Default projection removes duplicate data.
  2. Selection (σ): Selection is used to select required tuples of the relations.
    for the above relation
    σ (c > 3)R
    will select the tuples which have c more than 3.
    Note: selection operator only selects the required tuples but does not display them. For displaying, data projection operator is used.
    For the above selected tuples, to display we need to use projection also.Relational Algebra | Database Management System (DBMS) - Computer Science Engineering (CSE)
  3. Union (U): Union operation in relational algebra is same as union operation in set theory, only constraint is for union of two relation both relation must have same set of Attributes.
  4. Set Difference (-): Set Difference in relational algebra is same set difference operation as in set theory with the constraint that both relation should have same set of attributes.
  5. Rename (ρ): Rename is a unary operation used for renaming attributes of a relation.
    ρ (a/b)R will rename the attribute ‘b’ of relation by ‘a’.
  6. Cross Product (X)
    Cross product between two relations let say A and B, so cross product between A X B will results all the attributes of A followed by each attribute of B. Each record of A will pairs with every record of B.
    below is the exampleRelational Algebra | Database Management System (DBMS) - Computer Science Engineering (CSE)Note: if A has ‘n’ tuples and B has ‘m’ tuples then A X B will have ‘n*m’ tuples.
  7. Natural Join (⋈): Natural join is a binary operator. Natural join between two or more relations will result set of all combination of tuples where they have equal common attribute.
    Let us see below exampleRelational Algebra | Database Management System (DBMS) - Computer Science Engineering (CSE)
  8. Conditional Join: Conditional join works similar to natural join. In natural join, by default condition is equal between common attribute while in conditional join we can specify the any condition such as greater than, less than, not equal
    Let us see below exampleRelational Algebra | Database Management System (DBMS) - Computer Science Engineering (CSE)
The document Relational Algebra | Database Management System (DBMS) - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Database Management System (DBMS).
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
62 videos|66 docs|35 tests

Top Courses for Computer Science Engineering (CSE)

FAQs on Relational Algebra - Database Management System (DBMS) - Computer Science Engineering (CSE)

1. What is Relational Algebra?
Relational Algebra is a procedural query language used to retrieve and manipulate data stored in relational databases. It provides a set of operations that can be applied to relations, such as selection, projection, union, intersection, difference, join, and division. These operations allow users to perform various operations on tables and generate new tables as a result.
2. What are the main operations in Relational Algebra?
The main operations in Relational Algebra are: - Selection: This operation selects rows from a relation that satisfy a specified condition. - Projection: This operation selects specific columns from a relation. - Union: This operation combines two relations and eliminates duplicate tuples. - Intersection: This operation returns the common tuples between two relations. - Difference: This operation returns the tuples that are present in one relation but not in the other. - Join: This operation combines two relations based on a common attribute. - Division: This operation returns the tuples from one relation that are associated with all tuples from another relation.
3. How is Relational Algebra different from SQL?
Relational Algebra and SQL are both query languages used to retrieve and manipulate data in relational databases. However, there are some differences between them: - Relational Algebra is a procedural query language, while SQL is a declarative query language. In Relational Algebra, users specify how to retrieve the data step by step, while in SQL, users specify what data they want, but not how to retrieve it. - Relational Algebra provides a mathematical foundation for relational databases, while SQL is based on relational algebra but extends it with additional features. - Relational Algebra is more suited for theoretical analysis and understanding of database operations, while SQL is more practical and widely used in real-world applications.
4. How does Relational Algebra handle null values in databases?
Relational Algebra handles null values in databases by treating them as unknown or missing values. When performing operations like selection, projection, or join, a null value will not match any condition or value, and it will not be included in the result. However, when performing operations like union or intersection, if one relation has a null value for a certain attribute and the other relation has a non-null value for the same attribute, the null value will be treated as a distinct value and included in the result.
5. Can Relational Algebra be used for complex queries and data manipulation?
Yes, Relational Algebra can be used to perform complex queries and data manipulation. By combining multiple operations, such as selection, projection, join, and division, users can express complex queries and retrieve the desired data from relational databases. Additionally, Relational Algebra provides a foundation for other database query languages, such as SQL, which further extend its capabilities and allow for even more complex queries and data manipulation.
62 videos|66 docs|35 tests
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Previous Year Questions with Solutions

,

video lectures

,

Sample Paper

,

Important questions

,

Summary

,

Exam

,

study material

,

Relational Algebra | Database Management System (DBMS) - Computer Science Engineering (CSE)

,

Relational Algebra | Database Management System (DBMS) - Computer Science Engineering (CSE)

,

Objective type Questions

,

Free

,

practice quizzes

,

mock tests for examination

,

ppt

,

pdf

,

Relational Algebra | Database Management System (DBMS) - Computer Science Engineering (CSE)

,

Semester Notes

,

MCQs

,

shortcuts and tricks

,

Viva Questions

,

Extra Questions

,

past year papers

;