trainingtrains Logo

91-9990449935

 0120-4256464

PostgreSQL WHERE Clause

The WHERE clause specifies a condition while you fetch data from a table or a join of multiple tables. It is generally used with SELECT, UPDATE and DELETE statements to filter the results. It returns the specific result only when the condition is satisfied.


WHERE Clause with SELECT statement

Syntax:

Note: WHERE condition can be used with logical operators such as >, <, =, LIKE, NOT, OR, AND etc.


Example1.

WHERE clause with single condition:

Let's take a table "EMPLOYEES" having the following data.

 postgresql where clause

Execute the following query to return a single record:

Output:

 postgresql where clause

Example2:

WHERE clause with multiple conditions

We are using the same table "EMPLOYEES" for this example also.

Execute the following query:

Output:

 postgresql where clause