Menu

PostgreSQL Basics

Learn PostgreSQL data operations with practical guides to SELECT, filters, joins, inserts, updates, deletes, and grouping.

This chapter introduces the knowledge related to data operations in PostgreSQL, including inserting data rows, deleting data rows, updating/modifying, querying data, filtering data, etc.

  1. PostgreSQL SELECT

    This article describes the basic syntax of the SELECT statement and how to use the SELECT statement to query data from a data table.
  2. PostgreSQL WHERE

    This article describes how to use WHERE clause in a SELECT statement to filter rows in PostgreSQL.
  3. PostgreSQL ORDER BY

    This article describes how to use the ORDER BY clause sort the result set returned by the SELECT statement in PostgreSQL.
  4. PostgreSQL FETCH

    This article describes how to use the FETCH clause in the PostgreSQL SELECT statement to limit the number of rows returned by a query.
  5. PostgreSQL LIMIT

    This article describes how to use the LIMIT clause in the SELECT statement to limit the number of rows returned by a query.
  6. PostgreSQL OFFSET

    This article describes how to use the OFFSET clause in a SELECT statement to skip a specified number of rows.
  7. PostgreSQL DISTINCT

    This article describes how to use in PostgreSQL DISTINCT to return a result set with no duplicate rows.
  8. PostgreSQL Column Alias

    This article describes aliasing a column in PostgreSQL to improve readability of the output.
  9. PostgreSQL Table Alias

    This article describes how to use table aliases in PostgreSQL.
  10. PostgreSQL IN

    This article describes how to use the IN operator check if a list of values ​​contains a specified value.
  11. PostgreSQL BETWEEN

    This article describes how to use the BETWEEN operator check if a value is in an interval.
  12. PostgreSQL LIKE

    This article describes how to use the LIKE operator check if a text matches a specified pattern.
  13. PostgreSQL IS NULL

    This article describes how to use the IS NULL operator check if a value is NULL.
  14. PostgreSQL EXISTS

    This article describes how to use the EXISTS operator check if a subquery returns rows.
  15. PostgreSQL ALL

    This article describes how to use the ALL operator compare a value with all the values ​​returned by a subquery.
  16. PostgreSQL ANY

    This article describes how to use the ANY operator check if at least one value in a set of values satisfies the specified condition.
  17. PostgreSQL GROUP BY

    This article describes how to use the GROUP BY clause in a PostgreSQL SELECT statement to group rows according to a specified column or expression.
  18. PostgreSQL HAVING

    This article describes how to use the HAVING clause specify filter conditions for grouped queries.
  19. PostgreSQL GROUPING SETS

    This article describes how to use GROUPING SETS in a GROUP BY clause to generate a report on multiple dimensions in one query.
  20. PostgreSQL ROLLUP

    This article describes how to use ROLLUP in a GROUP BY clause to generate a report on multiple dimensions in one query.
  21. PostgreSQL CUBE

    This article describes how to use CUBE in a GROUP BY clause to generate a report on multiple dimensions in one query.
  22. PostgreSQL JOIN

    This article introduces join statements in PostgreSQL, including cross join, inner join, natural join, left join, right join, and full join.
  23. PostgreSQL Subqueries

    This article describes how to use subqueries in PostgreSQL.
  24. PostgreSQL CTE

    This article describes how to use common table expressions in PostgreSQL.
  25. PostgreSQL UNION

    This article describes how to merge two result sets using the UNION operator.
  26. PostgreSQL INTERSECT

    This article describes how to use the INTERSECT operator to compute the intersection of two sets.
  27. PostgreSQL EXCEPT

    This article describes how to use the EXCEPT operator get a difference from two sets.
  28. PostgreSQL INSERT

    Learn PostgreSQL INSERT syntax, conflict handling, and how RETURNING reports inserted or updated rows.
  29. UPSERT: ON CONFLICT

    Use PostgreSQL INSERT ON CONFLICT to skip duplicate rows or update them, with conflict targets, EXCLUDED, and RETURNING examples.
  30. PostgreSQL UPDATE

    Learn PostgreSQL UPDATE syntax, filter rows safely, and return changed values with RETURNING.
  31. PostgreSQL UPDATE...FROM

    Learn PostgreSQL UPDATE FROM syntax with a working example, a correct join condition, and a warning about duplicate source matches.
  32. PostgreSQL RETURNING OLD and NEW

    PostgreSQL 18 lets INSERT, UPDATE, DELETE, and MERGE return OLD and NEW row values in one statement. See syntax and runnable examples.
  33. PostgreSQL DELETE

    Learn PostgreSQL DELETE syntax, choose rows safely, and return deleted values with RETURNING.
  34. PostgreSQL TRUNCATE

    This article will describes how to use the TRUNCATE TABLE statement to empty one or more tables.
  35. PostgreSQL CASE

    This article describes how to implement logical processing using PostgreSQL CASE conditional expressions.