On this page
  1. CAST
  2. Syntax & Overview
  3. Notes & Best Practices
  4. Example

CAST

Prev: `CASE` | Up: functions | Next: `ROW NUMBER`
Rel: functions, Aggregations, CTEs & Window Functions
Ref: PostgreSQL — SQL Commands
Tags: #public #databases #sql #functions #tier/core


Syntax & Overview

CAST(price AS INTEGER)  /* PG shorthand: price::int */

Explicitly converts an expression to a target SQL data type.

Notes & Best Practices

Example

SELECT CAST('42' AS INTEGER) + 8 AS total;

Linked from

Related notes