Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sysdate in oracle sql

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 :: search db for table name 
Sql :: sql select data from last week 
Sql :: sql update table based on another table 
Sql :: how to remove default in mysql 
Sql :: connecting to mysql database using python 
Sql :: mysql jdbc timezone 
Sql :: create function in postgresql 
Sql :: t-sql get duplicate rows 
Sql :: alter database name script 
Sql :: MYSQL HOT TO COUNT THE DURATION BETWEEN TWO DATES 
Sql :: get day in sql 
Sql :: grant read only privileges postgres user 
Sql :: mysql date to string 
Sql :: incorrect string value: mysql 
Sql :: mysql delete user if exists 
Sql :: convert rows to string sql server 
Sql :: sql check double value 
Sql :: postgres type cast to string 
Sql :: find duplicates mysql 
Sql :: drop index oracle 
Sql :: install mysql workbench ubuntu 20.04 
Sql :: foreign key mysql 
Sql :: CONCAT_WS() concat function in mysql 
Sql :: sql distinct with count 
Sql :: how to change column name in sql 
Sql :: find lowest number in sql 
Sql :: sql server locks 
Sql :: run mysql file in terminal 
Sql :: t sql null or empty string 
Sql :: ascending order mysql 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =