Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

how to casting data types in postgresql

CAST( expression AS target_type); 
-- example) extract from String into an integer
SELECT CAST('500' AS INTEGER);
--  or 
expression :: type
-- example) extract from '2019-07-13 1:20:50' to '2019-07-13'
SELECT '2019-07-13 1:20:50'::TIMESTAMP::DATE;
 
PREVIOUS NEXT
Tagged: #casting #data #types #postgresql
ADD COMMENT
Topic
Name
7+8 =