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 :: mysql error incompatible with sql_mode=only_full_group_by 
Sql :: SQL SERVER SELECT BETWEEN DATETIME 
Sql :: how to alter length character varying postgres 
Sql :: oracle db get table sizes 
Sql :: postgresql substring 
Sql :: a network or instance-specific error sql server 
Sql :: sql problems 
Sql :: node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v72-win32-x64.tar.gz 
Sql :: change old domain to new domain name wordpress 
Sql :: oracle invalid table name 
Sql :: postgresql list users 
Sql :: clone table structure mysql 
Sql :: oracle auto_increment 
Sql :: sql limit decimal places 
Sql :: mysql start command 
Sql :: insert value in identity 
Sql :: disable trigger sql oracle 
Sql :: delete top N rows in sql 
Sql :: sql offset 
Sql :: round one decimal place mysql 
Sql :: mysql CAST(amount as float) 
Sql :: calculate distance between two latitude longitude points sql 
Sql :: reseed sql table primary key 
Sql :: mysql grant access to one database 
Sql :: snowflake datetrunc month 
Sql :: how to truncate table with foreign key constraint postgresql 
Sql :: How do I modify a MySQL column to allow NULL? 
Sql :: Get monday of week date is in SQL 
Sql :: how to create a table in mysql 
Sql :: mysql get last insert id 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =