Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql first day of year

SELECT DATEADD(yy, DATEDIFF(yy, 0, GETDATE()), 0);			-- SQL Server
SELECT TRUNC(sysdate, 'YEAR') FROM DUAL;					-- Oracle
SELECT MAKEDATE(year(now()), 1);							-- MySQL
Comment

mysql first day of month

-- Replace curdate() with your date column
SELECT curdate(), 
	DATE_SUB( curdate(), INTERVAL DAYOFMONTH(curdate())-1 DAY ) AS '1st of month';
Comment

mysql first day of month date

DATE(FORMAT_DATE('%Y-%m-01', CURRENT_DATE() ))
Comment

PREVIOUS NEXT
Code Example
Sql :: psql connections 
Sql :: update part of a string in mysql 
Sql :: STRING_AGG order by 
Sql :: this is incompatible with sql_mode=only_full_group_by 
Sql :: spark sql concatenate string and int 
Sql :: oracle select first 10 rows 
Sql :: autoincrement sqlite command 
Sql :: how to duplicate table in mysql 
Sql :: rename table sql 
Sql :: mysql version check cmd 
Sql :: sql query to find duplicates in column 
Sql :: crontab every month 
Sql :: mysql find most common value 
Sql :: sqlite list columns 
Sql :: postgresql concatenate multiple rows in group by 
Sql :: how to get last row of table in sql 
Sql :: postgres delete database 
Sql :: select dba users oracle 
Sql :: mysql import sql file 
Sql :: query to check cpu utilization in oracle database 
Sql :: oracle alter sequence nextval 
Sql :: how much every mysql database record takes from diskspace 
Sql :: t-sql find object by name 
Sql :: sqlite foreign key 
Sql :: mysql random number between 1 and 100 
Sql :: oracle export trigger ddl 
Sql :: postgresql create table with timestamp 
Sql :: sql output inserted id 
Sql :: mysql current user 
Sql :: mysql modify default value 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =