SQL has some builtin functions (Mainly Numeric, String and Date/Time) which can be used to manipulate data during fetch or insertion. The concept of those functions is same as function in any programming language. The function will accept parameters and return some value. We will explore POW, CURRENT_DATE, ADDATE, SUBDATE, DATEDIF, ROUND, FORMAT, FLOOR, CEILING, TRUNCATE, UPPER, CONCAT, LENGTH, LEFT, MID, IF,
In SQL it is required that there should not be any space between the name of the function and the parenthesis. So function POW(3, 2) is different than POW (3, 2) as there is a space in the second function. The first one will work but the second one will throw an error
To round or truncate number. It takes one argument and round up or down a floating point number to nearest integer.
You have the option to choose how many decimal points you would like to have in the return value. The second parameters indicates the number of decimal points you want to have.
This function is used to format a number with commas to make any big number more readable. Just be cautious that the return value will be a String not a number as it will have comma(s) in between the number.
It means the power. So if you want to put 2 to the power 3 then the function will be:
This function takes no argument. It will return the current date based on your server’s time zone. The format will be YYYY-MM-DD.