SQL expressions

Expressions in the select-list are called value expressions or scalar expressions. This is because each expression in the select-list always returns only one value (but the value can be an array).

Scalar expressions can also be called SQL expressions or simply expressions. Each expression in SQL has its data type. It is determined by the data type(s) of the input. In many cases, it is possible to explicitly change the type of the data. Each item of the select-list becomes a column in the output dataset of a type that the corresponding expression has.

SQL expressions can contain the following:

  • Column names (most of the cases)
  • Constants
  • Operator invocations
  • Parentheses to control operations, precedence
  • Function calls
  • Aggregate ...

Get Learning PostgreSQL 10 - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.