CAST(expression AS data_type)
expression::data_type -- PostgreSQL shorthand
example
SELECT
CAST(price AS INTEGER) AS rounded_price,
CAST(order_date AS VARCHAR) AS date_string,
'42'::INTEGER + 8 AS sum_pg -- PostgreSQL only
FROM products;
Note CAST is ANSI standard. PostgreSQL's :: shorthand is shorter but not portable. Be careful casting — CAST('abc' AS INTEGER) will throw an error. Use TRY_CAST in SQL Server for safe conversions.