PostgreSQL – WHERE

PostgreSQL WHERE clause is used to filter rows of a table based on the condition applied on the columns of the table.

The syntax of WHERE clause to be used along with SELECT FROM statement is as follows.

</>
Copy
 SELECT column1, column2, columnN
	FROM table_name
	WHERE search_condition;

where

  • column1, column2, columnN are the columns you want in the result.
  • table_name is the name of the table from which the rows are fetched.
  • search_condition is an expression that specifies the condition [usually on the column values].

Basic Example of WHERE clause

Consider the following table. We will apply WHERE clause on this table and use the same for all subsequent examples.