Database Systems: Lecture 5 - Relational Algebra presents about Relational Algebra (Unary Relational Operations, Relational Algebra Operations from Set Theory, Binary Relational Operations, Additional Relational Operations), Brief Introduction to Relational Calculus. | Relational Algebra Outline Relational Algebra Unary Relational Operations Relational Algebra Operations from Set Theory Binary Relational Operations Additional Relational Operations Brief Introduction to Relational Calculus Reading: [1]: Chapter 6 Relational Algebra Overview Relational algebra is the basic set of operations for the relational model These operations enable a user to specify basic retrieval requests (or queries) The result of an operation is a new relation, which may have been formed from one or more input relations This property makes the algebra “closed” (all objects in relational algebra are relations) A sequence of relational algebra operations forms a relational algebra expression The result of a relational algebra expression is also a relation that represents the result of a database query (or retrieval request) Relational Algebra Overview Relational Algebra consists of several groups of operations Unary Relational Operations SELECT (symbol: . | Relational Algebra Outline Relational Algebra Unary Relational Operations Relational Algebra Operations from Set Theory Binary Relational Operations Additional Relational Operations Brief Introduction to Relational Calculus Reading: [1]: Chapter 6 Relational Algebra Overview Relational algebra is the basic set of operations for the relational model These operations enable a user to specify basic retrieval requests (or queries) The result of an operation is a new relation, which may have been formed from one or more input relations This property makes the algebra “closed” (all objects in relational algebra are relations) A sequence of relational algebra operations forms a relational algebra expression The result of a relational algebra expression is also a relation that represents the result of a database query (or retrieval request) Relational Algebra Overview Relational Algebra consists of several groups of operations Unary Relational Operations SELECT (symbol: (sigma)) PROJECT (symbol: (pi)) RENAME (symbol: (rho)) Relational Algebra Operations from Set Theory UNION ( ), INTERSECTION ( ), DIFFERENCE (or MINUS, – ) CARTESIAN PRODUCT ( x ) Binary Relational Operations JOIN (several variations of JOIN exist) DIVISION Additional Relational Operations OUTER JOINS, OUTER UNION AGGREGATE FUNCTIONS (SUM, COUNT, AVG, MIN, MAX) COMPANY Database Schema All examples discussed below refer to the COMPANY DB below: The following query results refer to this database state Unary Relational Operations: SELECT The SELECT operation (denoted by (sigma)) is used to select a subset of the tuples from a relation based on a selection condition. Examples: Select the EMPLOYEE tuples whose department number is 4: DNO = 4 (EMPLOYEE) Select the employee tuples whose salary is greater than $30,000: SALARY > 30,000 (EMPLOYEE) Unary Relational Operations: SELECT In general, the select operation is denoted by (R)