PostgreSQL – SELECT FROM Table Query

In this tutorial, we will learn to query rows of a PostgreSQL table using SELECT FROM query statement.

PostgreSQL SELECT – All columns and all rows

The syntax of a simple SELECT FROM query is:

</>
Copy
 SELECT *
	FROM tablename;

This query returns all the columns and all the rows of the table.

PostgreSQL INSERT INTO table

PostgreSQL SELECT – Only specific columns

To query only specific columns of the table, specify those column names after SELECT  keyword.

</>
Copy
 SELECT column1, column2
	FROM tablename;
PostgreSQL SELECT FROM table

PostgreSQL SELECT – Only first N number of rows

To query only specific columns of the table, specify those column names after SELECT  keyword.

</>
Copy
 SELECT *
	FROM tablename;
	LIMIT 2;
PostgreSQL - SELECT FROM Table Limit Rows

Conclusion

In this PostgreSQL Tutorial, we have learnt to execute SELECT FROM Table query.