Professional Documents
Culture Documents
3-2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Lesson Agenda
3-3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Limiting Rows Using a Selection
EMPLOYEES
…
“retrieve all
employees in
department 90”
3-4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Limiting the Rows That Are Selected
3-5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Using the WHERE Clause
3-6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Character Strings and Dates
SELECT last_name
FROM employees
WHERE hire_date = '17-FEB-96' ;
3-7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Comparison Operators
Operator Meaning
= Equal to
> Greater than
>= Greater than or equal to
< Less than
<= Less than or equal to
<> Not equal to
BETWEEN Between two values (inclusive)
...AND...
3-8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Using Comparison Operators
3-9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Range Conditions Using the BETWEEN Operator
SELECT first_name
FROM employees
WHERE first_name LIKE 'S%' ;
• You can use the ESCAPE identifier to search for the actual
% and _ symbols.
Operator Meaning
AND Returns TRUE if both component conditions
are true
OR Returns TRUE if either component condition
is true
NOT Returns TRUE if the condition is false
Operator Meaning
1 Arithmetic operators
2 Concatenation operator
3 Comparison conditions
4 IS [NOT] NULL, LIKE, [NOT] IN
5 [NOT] BETWEEN
6 Not equal to
7 NOT logical condition
8 AND logical condition
9 OR logical condition
…
3 - 23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Sorting
... salary = ? …
… department_id = ? …
... last_name = ? ...
I want
to query
different
values.
…
3 - 33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Lesson Agenda
UNDEFINE employee_num