PostgreSQL Select

Select command is used to retrieve database from PostgreSQL table or view. In this article, we are going to see actions can be performed by PostgreSQL Select statement.

To execute this user must be granted SELECT privilege.

PostgreSQL Select Syntax:

SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] [ * | expression [ [ AS ] output_name ] [, ...] ] [ FROM from_item [, ...] ] [ WHERE condition ] [ GROUP BY grouping_element [, ...] ] [ HAVING condition [, ...] ]SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] [ * | expression [ [ AS ] output_name ] [, ...] ] [ FROM from_item [, ...] ] [ WHERE condition ] [ GROUP BY grouping_element [, ...] ] [ HAVING condition [, ...] ]

PostgreSQL Select Examples:

1. To get all the data from a table in PostgreSQL.

select * from dept;

PostgreSQL Select

2. Get the data from a table with where clause in PostgreSQL.

select * from dept where deptno >20;