Sunday, August 21, 2016

SQL - WHERE Clause

Oracle SQL - WHERE Clause:

You can restrict the rows retrieved by an SQL query using where condition.
WHERE  condition should always be followed by FROM in SQL query

Syntax :

SELECT *|{[DISTINCT] column [alias],...}
FROM table
[WHERE logical expression(s)];

Examples:

The below query returns only the employees from department_id=10
* means  -> select all the columns in the table

SELECT *
FROM employees
WHERE department_id=30;

Character and date values in the where clause should be enclosed in single quotes.

SELECT *
FROM employees
WHERE first_name='Karen';

SELECT *
FROM employees
WHERE hire_date='10-AUG-2007';


Default date format is DD-MON-YYYY

Featured Post

Will the data from Oracle Database be lost after formatting the system in which it is installed?

So Someone asked me a question,  Will the data from Oracle Database be lost after formatting the system in which it is installed? Since the ...

Popular Posts