Postgres SQL - Basic Queries
1 - Select
Basic select
-- Fetch all data
SELECT * from films
-- Cherry pick data to fetch
SELECT column_1, column_2 from films
-- statement with expressions example
SELECT
first_name || ' ' || last_name AS full_name,
email
FROM
customer;
ORDER BY
SELECT
column_1,
column_2
FROM
table_name
ORDER BY
column_1 [ASC | DESC],
column_2 [ASC | DESC];
WHERE
SELECT select_list
FROM table_name
WHERE condition;
LIMIT
SELECT
*
FROM
table
LIMIT n [OFFSET m];
- n : number of rows returned
- m : number of rows skiped