0% found this document useful (0 votes)
2 views6 pages

3 Functions

The document provides a list of string and date functions used in SQL, detailing their descriptions and syntax. String functions include CONCAT, LEFT, RIGHT, LENTH, LOWER, LTRIM, and FORMAT, while date functions include CURDATE, CURTIME, DATE, DATEDIFF, DATE_FORMAT, DAY, MONTH, and YEAR. Additionally, it includes links to MySQL and SQL Server function references.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

3 Functions

The document provides a list of string and date functions used in SQL, detailing their descriptions and syntax. String functions include CONCAT, LEFT, RIGHT, LENTH, LOWER, LTRIM, and FORMAT, while date functions include CURDATE, CURTIME, DATE, DATEDIFF, DATE_FORMAT, DAY, MONTH, and YEAR. Additionally, it includes links to MySQL and SQL Server function references.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

FUNCTIONS

Le Duc Hau
[email protected]
STRING FUNCTIONS
List of Functions

Function Description Syntax

CONCAT Adds two or more strings together CONCAT(str1, str2,.., strn)

Extracts a number of characters from a string


LEFT LEFT(string, number_of_chars)
(starting from left)
Extracts a number of characters from a string (starting
RIGHT RIGHT(string, number_of_chars)
from right)

LENTH Returns the length of a string LENTH(string)

LOWER Converts a string to lower-case LOWER(string)

LTRIM Removes leading spaces from a string LTRIM(string)

FORMAT Formats a value with the specified format FORMAT(value, format)


DATE FUNCTIONS
List of Functions

Function Description Syntax

CURDATE Returns the current date CURDATE()

CURTIME Returns the current time CURTIME()

DATE Extracts the date part from a datetime expression DATE(expression)

DATEDIFF Returns the number of days between two date values DATEDIFF(date1, date2)

DATE_FORMAT Formats a date DATE_FORMAT(date, format)

DAY Returns the day of the month for a given date DAY(date)

MONTH Returns the month part for a given date MONTH(date)

YEAR Returns the year part for a given date YEAR(date)


List of Functions

• MySQL: https://www.w3schools.com/sql/sql_ref_mysql.asp
• SQL Server: https://www.w3schools.com/sql/sql_ref_sqlserver.asp

You might also like