Relational algebra operators are fundamental operations used in Relational Database Management Systems (RDBMS) to manipulate and retrieve data from relational databases. These operators form the basis for querying and manipulating data in the relational model. Here are some commonly used relational algebra operators:
1. Selection (σ):
The selection operator filters rows from a relation based on specified conditions. It retrieves tuples that satisfy a given predicate or condition. The operator is denoted by the Greek letter sigma (σ). For example:
σ(Age > 18)(Students)
This expression selects all tuples from the "Students" relation where the age is greater than 18.
2. Projection (π):
The projection operator selects specific columns (attributes) from a relation while discarding the rest. It retrieves a subset of attributes from a relation. The operator is denoted by the Greek letter pi (π). For example:
π(Name, Age)(Students)
This expression retrieves only the "Name" and "Age" attributes from the "Students" relation.
3. Cartesian Product (×):
The Cartesian product operator combines two relations to create a new relation by pairing each tuple from the first relation with every tuple from the second relation. It generates a new relation with all possible combinations of tuples. The operator is denoted by the multiplication symbol (×). For example:
Students × Courses
This expression combines the "Students" and "Courses" relations to create a new relation with tuples representing all possible combinations of students and courses.
4. Join (⋈):
The join operator combines tuples from two or more relations based on a common attribute or condition. It retrieves tuples that satisfy the join condition. The operator is denoted by the join symbol (⋈). For example:
Students ⋈ Enrollments
This expression joins the "Students" and "Enrollments" relations based on a common attribute (such as StudentID) to retrieve tuples representing student enrollments.
5. Union (∪):
The union operator combines tuples from two relations and eliminates duplicate tuples, resulting in a new relation. It retrieves all distinct tuples from both relations. The operator is denoted by the union symbol (∪). For example:
Students ∪ Faculty
This expression combines the tuples from the "Students" and "Faculty" relations, eliminating duplicates, to create a new relation representing all distinct individuals in both groups.
These are some of the core relational algebra operators used in RDBMS. They provide a foundation for performing various operations, including data retrieval, filtering, combining, and transforming data in a relational database.
Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.
We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc