Relational Algebra – Selection Operation (σ) in DBMS

Relational Algebra Operations – Selection (σ)

In the Relational Algebra of DBMS, the Selection Operation is used to extract specific rows (tuples) from a relation (table) that satisfy a given condition. It acts as a filtering operation, similar to the WHERE clause in SQL.


🔹 Definition

The Selection operation is a unary operation (applies on a single relation). It selects those rows that satisfy a specified predicate or condition.

Notation:

σcondition(Relation_Name)

Here, σ (sigma) denotes the selection operator, and the subscript specifies the condition.


🔹 Example (Bangladeshi Context)

Consider the following relation Student:

Student_IDNameAgeDepartmentDistrict
101Rafi Ahmed22CSEDhaka
102Shanta Rahman21EEEKhulna
103Tanvir Hasan23CSERajshahi
104Sumaiya Akter20BBADhaka
105Imran Hossain24CSEChattogram

🟩 Example 1: Selecting Students from Dhaka

Operation:

σDistrict = 'Dhaka'(Student)

Result:

Student_IDNameAgeDepartmentDistrict
101Rafi Ahmed22CSEDhaka
104Sumaiya Akter20BBADhaka

Explanation: Only those tuples where District = 'Dhaka' are selected.


🟩 Example 2: Selecting CSE Students Aged Over 22

Operation:

σDepartment = 'CSE' AND Age > 22(Student)

Result:

Student_IDNameAgeDepartmentDistrict
105Imran Hossain24CSEChattogram

Explanation: The query selects only students from the CSE department whose age is greater than 22.


🔹 Common Selection Conditions

  • Comparison: <, <=, >, >=, =, ≠
  • Logical Operators: AND (∧), OR (∨), NOT (¬)
  • Range Condition: BETWEEN, IN, etc.

Examples:

  • σAge > 21(Student)
  • σDepartment = 'EEE' OR Department = 'CSE'(Student)
  • σDistrict ≠ 'Dhaka'(Student)

🔹 Key Properties

  • Selection is a filtering operation — it does not alter columns, only filters rows.
  • The output relation has the same attributes as the input relation.
  • It can be combined with other operations like projection and join for complex queries.

✅ Summary

FeatureDescription
Operatorσ (Sigma)
PurposeSelects tuples that satisfy a condition
InputOne relation
OutputSubset of rows of the same relation
SQL EquivalentSELECT * FROM table WHERE condition;

relational algebra selection operation, dbms relational algebra, sigma operator example, selection operation in dbms, student table example bangladesh, relational algebra tutorial, dbms class notes

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন