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 :: check if record exists mysql 
Sql :: how to create enum in postgresql 
Sql :: how to fetch first 5 characters in sql 
Sql :: django mssql backend 
Sql :: how to get id of last inserted row in mysql 
Sql :: oracle show index columns 
Sql :: convert date to dd/mm/yyyy sql 
Sql :: mssql disable foreign key constraint 
Sql :: install mysql in ubuntu 
Sql :: sql trim all spaces 
Sql :: change date format in oracle query 
Sql :: sql substring before last occurrence of character 
Sql :: ubuntu connect to mssql database 
Sql :: load sql into mamp 
Sql :: SQL COUNT() with DISTINCT 
Sql :: dateadd in sql 
Sql :: print year of a date sql 
Sql :: how to find lowest in sql 
Sql :: sparql list all graphs 
Sql :: how to change a column name in postgresql 
Sql :: error code 1451 sql 
Sql :: oracle timestamp to date 
Sql :: sql count 
Sql :: CALCULATING MONTHS BETWEEN TWO DATES IN POSTGRESQL 
Sql :: sqlite autoincrement 
Sql :: sql concat 
Sql :: mysql union 
Sql :: laravel general error 2006 mysql server has gone away 
Sql :: sql insert from excel 
Sql :: mysql check if lowercase 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =