select attributelist from relationlist where condition 


select fname, lname from employee where dno = 5 The condition "dno=5" is applied to the set of employee tuples 
select fname, lname from employee, department where dno = 5 and dname = 'Research' The condition "dno=5 and dname='Research'" is applied to the tuples in the cartesian product employee × department 

atomicvalue IN ( set of values ) 
meaning:

Find the fname and lname of employees whose SSN is 123456789 or 333445555 
Solution:
SELECT fname, lname FROM employee WHERE ssn IN ('123456789', '333445555'); 
atomicvalue 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'); 

atomicvalue RelationalOperator any ( set of values ) 
meaning:

SELECT fname, lname FROM employee WHERE salary >= ANY ( 30000, 50000 ) 
Result of this query:


atomicvalue RelationalOperator all ( set of values ) 
meaning:

SELECT fname, lname FROM employee WHERE salary >= ALL ( 30000, 50000 ) 
Result of this query:


SELECT fname, lname FROM employee WHERE ssn = ANY ('111111111', '222222222') 
meaning:

In other words:

SELECT fname, lname FROM employee WHERE ssn != ALL ('111111111', '222222222') 
meaning:

In other words:

x = ANY ( set of values ) is the same as: x IN ( set of values ) 
x = ALL ( set of value ) // x is a single value, so x can // never be equal to all of the value // in the set !!! Example: x = ALL ( 1, 2 ) // x (one value) can't be BOTH equal // to 1 and equal to 2 ! 

exists ( set of values ) 
meaning:

atomicvalue IS NULL 
SELECT * FROM employee WHERE salary IS NULL 


Find fname and lname of employees whose last name start with an 'S' 
Solution:
SELECT fname, lname FROM employee WHERE lname LIKE 'S%' 


