RESTRICTING AND SORTING DATA

 
 Where clause  
Using the WHERE clause you can restrict the rows returned.
 
SELECT * | { [DITINCT] column | expression [alias]….}
FROM table
WHERE condition(s);
 
The WHERE clause follows FROM clause.
A WHERE clause contains conditions that must be met, and it directly follows theFROM clause.
If the condition is true, the row meeting the condition is returned.
Condition is composed of column name, expressions, constants and a comparisonoperator..
The where clause can compare values, literal values, arithmetic expressions or functions.
 
It consists of 3 elements:
Column name
Comparison parameter.
Column name, constant or list of values.
 
SELECT employee_id, last_name, job_id, department_id
FROM employees
WHERE department_id = 90;
 
Character strings are case sensitive ad date values are format sensitive.
Character string and date values are enclosed in single quotation (' ') marks.                 
Number constants however should not be enclosed in single quotation marks.
The default date format is DD-MON-RR.
Below is the example shows the character case sensitive in WHERE condition:
Here we are retrieving the row from employee table where alst name is Whalen:
 
SELECT last_name, job_id, department_id 
FROM employees 
WHERE last_name = 'Whalen';
 
LAST_NAME JOB_ID DEPARTMENT_ID
whalen AD_ASST 10

In the below example we are trying to compare the last name with CAPITAL format     of WHALEN, but employees table stores ass the last names in mixed case, so no rows are returned for the below query:

SELECT last_name, job_id, department_id 
FROM employees 
WHERE last_name = 'WHALEN';>

Oracle DB stores date in an internal numeric format, representing the century, year, month, day, hours, minutes and seconds. The defalut date display is DD-MON-RR.