SQL: Difference between revisions

From David's Wiki
No edit summary
 
Line 1: Line 1:
SQL basics
SQL basics


==Common functions==
==Common functions==

Latest revision as of 01:43, 12 February 2024

SQL basics

Common functions

Math functions

See Postgres math functions

  • Average
  • Sum
  • Round

Conditional functions

See Postgres conditional functions.

Joins

Joins merge two tables into a single table. You can think of this like an outer product, applying some conditions to subset from every possible combination of rows from the two tables.

  • Inner join - creates rows only if keys match between the rows
  • Left join - keep all rows from the left table
  • Right join - keep all rows from the right table
  • Outer join - keep rows from both tables.

Subqueries