Tuesday, January 15, 2013

WHERE


Structure:
SELECT COLUMNS FROM TABLE_NAME WHERE CONDITION;
CONDITION is a Boolean condition.
Examples Statement:
SELECT FIRST_NAME, SALARY FROM EMPLOYEES WHERE SALARY > 10000;


The statement returns records which salary is large than 10000. We could use other operators: 0, <, >, >=, <=, !=.
CONDITION could be many boolean conditions combined by AND or OR. The result of CONDITION follow Boolean rules, from left to right.
Examples Statement:
SELECT FIRST_NAME, SALARY
FROM EMPLOYEES
WHERE (SALARY < 10000 OR SALARY > 10000) AND MANAGER_ID = 101;
And we have the result:




No comments:

Post a Comment