|
(1) where salary > 40000 // salary is an attr name
// 40000 is a constant
(2) where dnumber = dno // 2 attr names
and sex = 'F' // attr name and a (string) constant
(3) where 2*salary > 40000 // Expression
|
atomic-value IS NULL
|
SELECT *
FROM employee
WHERE superssn IS NULL
Result:
+-----------+-------+-------+----------+
| ssn | fname | lname | superssn |
+-----------+-------+-------+----------+
| 888665555 | James | Borg | NULL |
+-----------+-------+-------+----------+
|
|
|
Example:
|
% will match any number of characters
_ will match exactly 1 character
|
atomic-value LIKE 'pattern'
|
|
Solution:
SELECT fname, lname
FROM employee
WHERE lname LIKE 'S%'
|
|
atomic-value IN ( set of values )
|
Meaning of the IN-clause:
|
|
Solution:
SELECT fname, lname
FROM employee
WHERE ssn IN ('123456789', '333445555');
|
atomic-value NOT IN ( set of values )
|
meaning:
|
| Find the fname and lname of employees whose SSN is not equal to 123456789 or 333445555 |
Solution:
SELECT fname, lname
FROM employee
WHERE ssn NOT IN ('123456789', '333445555');
|