Total Pageviews

Operators

Operators are symbols or words that cause an 'operation' to occur on one or more elements called 'operands'. Below are the types of Operators= <> > < >= <= BETWEEN AND [NOT] INIS [NOT] NULLEXISTSLIKE In this section will cover....

BETWEEN Operator:

To locate rows for which a numeric column is within a range of values.

Example:

Select the name and the employee's manager number for all employees whose job codes are in the 430000 range.

To locate rows for which a character column is within a range of values.

SELECT last_name

FROM employee

WHERE last_name BETWEEN 'r' AND 's';

last_name

------------

Ryan

IN Operator:
Use the IN operator as shorthand when multiple values are to be tested.Ex:Select the name and department for all employees in either department 401 or 403.SELECT first_name ,last_name ,department_number FROM employee WHERE department_number IN (401, 403);

first_namelast_namedepartment_number---------------------------------------------DarleneJohnson401 LorettaRyan403 ArmandoVillegas403 JamesTrader401 NOT in Operator:
Use the NOT IN operator to locate rows for which a column does not match any of a set of values

SELECT first_name ,last_name ,department_number FROM employee WHERE department_number NOT IN (401, 403) ;

first_namelast_namedepartment_number-------------------------------------------- CarolKanieski301 JohnStein301 LIKE operator:
The LIKE operator searches for patterns matching character data strings.

Here are some examples using the LIKE operator:

String pattern example:Meaning:
LIKE 'JO%'begins with 'JO'
LIKE '%JO%'contains 'JO' anywhere
LIKE '__HN'contains 'HN' in 3rd and 4th position
LIKE '%H_'contains 'H' in next to last position

Below are the examples

Display the full name of employees whose last name contains the letter "r" followed by the letter "a".