Review:
The SELECT command in SQL
- The SELECT
command
in SQL is used to
make query requests
to a RDBMS
- The basic
SELECT command
is as follows:
select <list of attributes>
from <list of relations>
[where <tuple-condition>] (<tuple-condition> ???)
|
- Effect:
- Retrieves the
specified attribute values
from tuples in the
specified relations
that
satisfy
the tuple-condition
|
|
Tuple condition (1):
conventional boolean expressions
Tuple condition (2):
pattern matching
Practice queries using the
LIKE clause
Formulate the following
queries
in SQL:
- Find (all information) of
employee whose
first name starts with
the letter J
- Find (all information) of
employee whose
first name
ends with
the letter N
- Find (all information) of
employee whose
first name starts with
the letter J
and
ends with
the letter N
- Find (all information) of
employee whose
lives in Houston
- Find (all information) of
employee whose
last name contains
exactly 4 letters
- Find first and last name of
employees who has
a dependent whose name
contains
li
- Find first and last name of
employees whose
first name
contains li and
who has
a dependent whose name
contains
li
|
Tuple condition (3):
membership test
Practice queries using the
IN clause
Formulate the following
queries using
IN:
Tuple condition (4):
existance/empty test
Practice queries using the EXISTS
clause
Formulate the following
queries using
EXISTS:
❮
❯