How To Use Where Clause In Oracle
Description
Where clause is an optional part of a select statement, update statement or delete statement.
Boolean expression is allowed in the where clause.
Syntax
- Where condition;
Example
In this example, use single condition.
Syntax
- Select
- *
- from
- Table_name
- where
- column_name = ’ ’;
Example
- Select
- *
- from
- Employee
- where
- Emp_name = ’King’;
Example
This example uses And condition.
Syntax
- Select
- *
- from
- Table_name
- where
- column_name = ’ ’
- AND Column_name condition;
Example
- Select
- *
- from
- Employee
- where
- Emp_name = ’Blake’
- AND Emp_Id <= 7003;
Example
The example, stated below uses or condition.
Syntax
- Select
- column_name
- From
- Table_name
- where
- column_name = ’ ’
- Or Column_name = ’ ’;
Example
- Select
- Emp_id
- from
- Employee
- where
- Emp_name = ’King’
- OR Emp_name = ’scott’;
Example
This example uses AND & OR condition.
Syntax
- Select
- *
- from
- Table_name
- where
- (
- column_name
- AND Column_name
- )
- OR(Condition);
Example
- Select
- *
- from
- Employee
- where
- (
- Emp_name = ’King’
- AND Salary = ’60000’
- )
- OR(Emp_Id > 7004);
Summary
Thus, we learnt, Where clause is an optional part of a select statement, update statement or delete statement. Boolean expression is allowed in the where clause. We learnt, how to use this clause in Oracle with the examples.