0:00

Okay, now we're going to talk about the Selection Operator and Relational Algebra.

So, the Selection Operator is one of

the most important operators in Relational Algebra because basically what it does,

so selection, you can refer to it with the sigma symbol and it works on one relation.

So, it's a unary operator in Relational Algebra,

in relation R, and then the P is a Predicate.

And the predicate again is a condition that you apply

on every single tuple or every single row in the relation that you're selecting from.

And this tuple has to satisfy this condition.

So, why is it very important?

Because basically, Selection Operator is the operator

responsible for information filtering in the table.

So, if you want to filter information based on

any kind of filtering condition you want to have,

that's the operator you use in Relational Algebra.

So, an example of an obvious Selection Operator is that,

if you have again the same example we have,

which is the student database.

So, you have the computer science table, computer science relation.

And you want to find all the students,

but not all of them you want,

all the students that are seniors in Computer Science.

The idea here is that,

the Relational Algebra will look like this.

So you select, that's the relation R. You select from the relation,

cse_major and that's again,

the symbol for selection.

And then, most importantly that's the selection predicate.

So, the selection predicate says that "I want seniors",

so class equal SR. SR is short for senior.

So, if the original table looks like this,

you have this original table if you apply this Relational Algebra operator selection,

the selection operator that we've just seen in previous slide.

So you filter out everything,

except the senior students.

So in this case,

you just filter out everything except senior,

and you just keep the senior students.

Again, this table can be way bigger than this.

We just have a sample of it here.

But in our case,

we have only one student,

student four that was senior,

and that's basically what we've done here,

only student four that was senior.

Selection operator did this. Thank you.