0% found this document useful (0 votes)
3 views2 pages

Selection in Relational Algebra

Selection in Relational Algebra is an operation that filters rows from a table based on a specified condition, represented by the symbol sigma. The equivalent SQL query uses the WHERE clause to achieve the same result, returning all columns for the selected rows. The process results in a new table containing only the rows that meet the filtering criteria.

Uploaded by

ahmedjahanzeb227
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Selection in Relational Algebra

Selection in Relational Algebra is an operation that filters rows from a table based on a specified condition, represented by the symbol sigma. The equivalent SQL query uses the WHERE clause to achieve the same result, returning all columns for the selected rows. The process results in a new table containing only the rows that meet the filtering criteria.

Uploaded by

ahmedjahanzeb227
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Projection in SQL (Relational Algebra Concepts)

Notes: Selection in SQL and Relational Algebra

Selection in SQL (Relational Algebra Concepts)

What is Selection?

In Relational Algebra, Selection is an operation used to pick specific rows (tuples) from a table based on a

condition.

It filters the table and returns only the rows that match the condition.

Symbol: sigma

Example (Relational Algebra)

Given a table STUDENT(id, name, age, course)

To get students older than 20, we write:

sigma age > 20 (STUDENT)

This means: Select rows where age is greater than 20.

Equivalent SQL Query:

SELECT * FROM STUDENT WHERE age > 20;

Key Features of Selection:

- Works on: Rows (not columns)

- Keeps: All columns, only selected rows

- Condition Used: Yes (filtering using WHERE)

- SQL Equivalent: SELECT * FROM table WHERE condition

- Output: A new table (relation) with filtered rows only

Example Table: STUDENT

| id | name | age | course |

|----|-------|-----|--------|

| 1 | Ali | 20 | CSE |
Projection in SQL (Relational Algebra Concepts)

| 2 | Sara | 21 | EEE |

| 3 | Rani | 22 | ME |

| 4 | Sara | 21 | EEE |

Relational Algebra Query:

sigma age > 20 (STUDENT)

Result:

| id | name | age | course |

|----|-------|-----|--------|

| 2 | Sara | 21 | EEE |

| 3 | Rani | 22 | ME |

| 4 | Sara | 21 | EEE |

Summary:

- Selection = Pick Rows

- Symbol = sigma

- SQL uses WHERE clause

- Keeps all columns but filters rows

You might also like