CodesJava

Easy learning with example program codes

SELECT Query in PostgreSQL

PostgreSQL SELECT

To fetch records from a table, one can use the UI or the PostgreSQL SELECT statement can be used.

 

SELECT statement using UI: 

Other than Query tool, we can also SELECT statement in PostgreSQL using UI. To SELECT statement using UI in PostgreSQL, follow the below steps.

  • Right-click on the selected table.
  • Move your cursor over the option scripts.
  • Click on the “SELECT script” option.
  • Put the values on the place of “?”.
  • Click on the “play” button.

The query will thus be executed.

Syntax 1: To select all fields from a table.

SELECT * FROM “table_name”;  

Example 1: Selecting all fields from a table.

SELECT * from “EMPLOYMENT”;

Output:

ID	STATE	RATE
1	A	60
2	B	70
3	C	65
4	D	80
5	E	78

Syntax 2: To select specific fields from a table.

SELECT “expressions”  
FROM “table_name”

Example 2: Selecting specific fields from a table.

SELECT “STATE”, “RATE”  
FROM “EMPLOYMENT”;

Output:

STATE	RATE
A	60
B	70
C	65
D	80
E	78
Please follow and like us:
error









Copyright © 2019 CodesJava DMCA.com Protection Status