Relational algebra is a mathematical foundation for relational databases, defining operations to manipulate and retrieve data.
Explanation:
Relational algebra provides fundamental operations such as:
- Selection (ฯ) โ Filters rows based on conditions.
- Projection (ฯ) โ Selects specific columns.
- Union (โช) โ Combines two relations.
- Intersection (โฉ) โ Returns common tuples.
- Difference (-) โ Finds tuples in one relation but not in another.
- Cartesian Product (ร) โ Merges two tables without conditions.
- Join (โจ) โ Combines tables based on a condition.
Example in SQL:
- Selection (ฯ condition(R)):
sqlCopyEditSELECT * FROM Employees WHERE department = 'HR';
- Projection (ฯ column1, column2(R)):
sqlCopyEditSELECT name, salary FROM Employees;
Leave a Reply