Relational Algebra | EECS-3421-A: Introduction to Database Systems | Fall 2016

Table of Contents

The SQL Language

Example of selection

Example of prjection

Example: extended projection

Example: $\T{R}_{1} := \T{R}_{2}\times\T{R}_{3}$

Example: natural join

Example: Renaming

$\boldsymbol{\Set{Q}_{1}}$. Products in customer's favorite colour

Show, for each customer (reporting the customer's name), the products by name that come in the customer's favourite colour.

$\boldsymbol{\Set{Q}_{2}}$. Products not in customer's favorite colour

Show, for each customer (reporting the customer's name), the products by name that do not come in the customer's favourite colour.

$\boldsymbol{\Set{Q}_{3}}$. Two or more in common

$\boldsymbol{\Set{Q}_{4}}$. Customers with all colours

$\boldsymbol{\Set{Q}_{5}}$. Most expensive items

Datalog