0% found this document useful (0 votes)
30 views

String Functions

The document describes various string and date functions in SQL. String functions include those for getting the length, converting case, concatenating, extracting substrings, repeating, trimming, padding, reversing, replacing parts of a string. Date functions allow getting components of dates and times, calculating differences between dates, and formatting dates as strings.

Uploaded by

xfgh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

String Functions

The document describes various string and date functions in SQL. String functions include those for getting the length, converting case, concatenating, extracting substrings, repeating, trimming, padding, reversing, replacing parts of a string. Date functions allow getting components of dates and times, calculating differences between dates, and formatting dates as strings.

Uploaded by

xfgh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

String Functions:

Char_length: gives the length of the string passed

Lower: convert the string to lowercase

Upper: convert the string to uppercase

Concat: used to concatenate two strings

Concat_ws() : used to concatenate more than two strings

Ascii () : gives the ascii value of the character passed

Substr() : takes the string, start position and end position (1-indexing type)

Repeat() : to repeat the string given number of times

Trim() : trim(Leading “0” from “string”)

Lpad(): is used to add the characters upto particular length to the left side

Rpad(): is used to add the characters upto particular length to the right side

Reverse(): used to reverse the string

Replace() : replace the string with the given characters.

Left() : to get the left side

Right(): to get right side characters in string

Date Functions:

Now(): returns the current date and time

Curdate(): gives the current date

Curtime(): gives the current time

Datediff(date1,date2): difference of the dates interms of days

Date(now()): get the date from the current time and date

DayName(now()) : gives the Day name

Month(now()): gives the month

MonthName(now()): gives the month name

Year(now()): year of the date

Hour(now()): hour of the time

Minute(now()): minute of the time


Second(now()): seconds of the time

You might also like