Select Operation¶
- Select operation selects all tuples that satisfy a given predicate
- It is written as \(\sigma_p(r)\) , where p is the selection predicate
Example¶
Take the table instructor
ID | name | dept_name | salary |
---|---|---|---|
222 | Hello | Physics | 165005 |
351 | World | Chemistry | 150406 |
SELECT * FROM instructor WHERE name = "World" becomes \(\(\sigma_{dept\_name\,=\,^"Physics^"}\,(instructor)\)\)
This gives the result
ID | name | dept_name | salary |
---|---|---|---|
222 | Hello | Physics | 165005 |
Sub-operations¶
- relational operators are allowed. Use ligatures (like \(\neq\), \(\geq\), \(\leq\))
- logical operators are also allowed (like \(\land\) , \(\lor\) , \(\lnot\) )
Example¶
SELECT * FROM instructors WHERE dept_name = 'Physics' AND salary > 100000
becomes \(\(\sigma_{dept\_name\,=\,'Physics'\,\land\,salary\,>\,100000 }(instructor)\)\)