### Unit 6: Relational Algebra

We have seen that database entities can be viewed as logical tables. While this is useful in its own way, we can learn more from the data if we can perform operations on the tables within a database, as data from one table may not be meaningful without the data from another table. In this unit, we will introduce relational algebra, the mathematical notation used to represent how data retrievals and updates are performed on tables in a database. Understanding relational algebra will serve as a prelude to using the Structure Query Language (SQL).

One of the overall themes of computer science is commonality: common components are useful for building many kinds of applications. A database is one of these components, and its usefulness is due to its effectiveness and efficiency in creating, storing, and operating on all types of data. Relational algebra covers basic operations and composing them to form complex queries. Relational algebra is a mathematical system, or model, that formally specifies queries of a relational database, and is implemented as a formal language, SQL. A query against a database can be expressed as a SQL statement in more than one way, each having the same semantics. Relational algebra enables optimization of SQL queries, and allows you to structure queries in such a way that they execute more efficiently.

Upon successful completion of this unit, you will be able to:

- explain the basic relational algebra operations;
- discuss relational algebra set operations; and
- explain what a derived operation is.

### 6.1: Basic Operations

Read this section.

Read this section.

### 6.2: Derived Operations

Read this page.

Watch this lecture.

### 6.3: Set Operations

Watch this lecture.

### 6.4: Aggregate Functions

Read the "Aggregate Functions" and "Aggregate Functions Examples" sections.