SELECT statement syntax
SELECT column1, column2, ... FROM table;
OR
SELECT * FROM table;
NOTE: (;) at the end of the SELECT statement is not a part of the SQL statement. It's just tells PostgreSQL engine the end of an SQL statement. You can use the semicolon to separate two SQL statements as well.
Database
Before we start, here are the links of the databases that I am using.
Northwind DataLet's select one column from customers table
Postgres has the same way as SQL to select data from database tables.
SELECT contact_name FROM customers;

Let's select more than one columns from customers.
We can just add as many columns as we want to get those columns in results of the SELECT query in Postgres. Same as SQL.
SELECT customer_id, contact_name, contact_title FROM customers;

What about all columns?
For all columns, just like SQL, use SELECT * from table_name.
SELECT * FROM customers;

Can we make a full address by concating two or more columns?
Let's try that on address by using SELECT statement with expressions.
SELECT address || city || postal_code AS Full_address FROM customers;

Seems like we can do that. I have not added the comma (,) in between the name of the city and zip code and address but we can always make it nice and more readable.
What about removing duplicates?
We can use DISTINCT with SELECT just like SQL.
SELECT DISTINCT contact_name FROM customers;

database examples select sql query