Search
 
SCRIPT & CODE EXAMPLE
 

SQL

oracle sysdate - 1 month

SELECT sysdate - 1 FROM dual; 				-- Yesterday    12/01/2021 14:27:27
SELECT trunc(sysdate) - 1 FROM dual; 		-- Yesterday    12/01/2021 00:00:00
SELECT sysdate + INTERVAL '20' DAY FROM DUAL;		-- 20 days ahead (other way)
SELECT sysdate - 1 / 24 FROM dual;					-- 1 hour ago
SELECT sysdate - 1 / 24 / 60 FROM dual;				-- 1 minute ago
SELECT add_months(trunc(sysdate), -1) FROM dual;   	-- 1 month ago (no time)
SELECT trunc(sysdate) - 30 FROM dual;				-- 30 days ago (no time)
SELECT add_months(trunc(sysdate), -12*2) FROM dual;	-- 2 years ago (no time)

-- ⇓ Test it ⇓ (Fiddle source link)
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql remove only_full_group_by permanently 
Sql :: join to find results not in another table 
Sql :: how to change mysql root password in windows 10 
Sql :: cast to float with .2 sql 
Sql :: python mysql query to dataframe 
Sql :: sql display number without decimals 
Sql :: delete role postgres 
Sql :: sql syntax create timestamp column 
Sql :: change default role snowflake 
Sql :: how to add unique key constraint in mysql 
Sql :: sql select where in list 
Sql :: postgresql default value boolean 
Sql :: convert rows to columns in sql server 
Sql :: media sql 
Sql :: postgresql today - 1 year 
Sql :: current year sql 
Sql :: concate update mysq 
Sql :: find duplicate keys in mysql 
Sql :: install beautifulsoup from terminal 
Sql :: tsql insert 
Sql :: sql first character 
Sql :: oracle sql listagg 
Sql :: CONCAT_WS() concat function we can use for adds two or more expressions together with a separator or delimeter. 
Sql :: get all tables using like 
Sql :: postgres check for foreign key 
Sql :: lowest salary in sql 
Sql :: mysql on update current_timestamp 
Sql :: run sql file in terminal 
Sql :: mysql utc timestamp 
Sql :: create or replace view postgress 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =