Search
 
SCRIPT & CODE EXAMPLE
 

SQL

snowflake datetrunc month

select to_date('2015-05-08T23:39:20.123-07:00') as "DATE1",
       date_trunc('YEAR', "DATE1") as "TRUNCATED TO YEAR",
       date_trunc('MONTH', "DATE1") as "TRUNCATED TO MONTH",
       date_trunc('DAY', "DATE1") as "TRUNCATED TO DAY";
Comment

datetrunc hour snowflake

select to_timestamp('2015-05-08T23:39:20.123-07:00') as "TIMESTAMP1",
       date_trunc('HOUR', "TIMESTAMP1") as "TRUNCATED TO HOUR",
       date_trunc('MINUTE', "TIMESTAMP1") as "TRUNCATED TO MINUTE",
       date_trunc('SECOND', "TIMESTAMP1") as "TRUNCATED TO SECOND";
Comment

PREVIOUS NEXT
Code Example
Sql :: add column if not exists mysql 
Sql :: generate sequence number in sql server 
Sql :: postgres delete all tables 
Sql :: mysql separator 
Sql :: mariadb alter table add column if not exists example 
Sql :: sql date diff 
Sql :: check constraint in sql 
Sql :: declare variables sql 
Sql :: How do I add a user to a postgres database? cli 
Sql :: multiple count in sql 
Sql :: How to drop a foreign key constraint in mysql ? 
Sql :: install sqlite npm 
Sql :: mysql update add to existing value 
Sql :: alter schema sql server 
Sql :: drop multiple columns in sql 
Sql :: oracle select first result 
Sql :: extract weekday from date in sql 
Sql :: group_concat in mysql 
Sql :: postgresql resolv duplicate value violates unique constraint 
Sql :: mysql milliseconds 
Sql :: update with select postgresql 
Sql :: sql check duplicate value in column 
Sql :: how to put value in variable mysql 
Sql :: postgresql create role 
Sql :: sql count null values in all columns 
Sql :: mysql delete duplicates 
Sql :: update with inner join sql server 
Sql :: launch sql script from docker in mysql 
Sql :: json with root element in sql server 
Sql :: sql server previous month 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =