IFNULL Function:- IFNULL Function is used to check given if expression is NULL. Syntax:- IFNULL(check expression, return value expression) Example:- SELECT IFNULL(NULL, “kshtutor.com”); Output:- kshtutor.com IN Function:- IN Function is used for finding a match
Continue ReadingAuthor: Veena Rani
MySQL Advanced Function Part-3
CURRENT_USER Function:- CURRENT_USER Function is used for returning MySQL username and hostname. Which MySQL use to authenticate the current clients. Syntax:- CURRENT_USER() Example:- SELECT CURRENT_USER(); Output:- guest@% DATABASE Function:- The DATABASE Function is used for
Continue ReadingMySQL Advanced Function Part-2
CAN_ACCESS_USER Function:- CAN_ACCESS_USER Function is used only for internal server operation. CAN_ACCESS_VIEW Function:- CAN_ACCESS_VIEW Function is used only for internal server operation. CASE Function:- CASE Function is used for conditional construct. It works like a
Continue ReadingMySQL Advanced Function Part-1
ANY_VALUE Function:- ANY_VALUE Function is used for returning any value in the specified column. ANY_VALUE Function is used with GROUP_BY statement. This function suppresses the error when ONLY_FULL_GROUP_BY mode is enabled. Syntax:- ANY_VALUE(column name) Example:-
Continue ReadingMySQL Date Or Time Function Part-8
TO_DAYS Function:- TO_DAYS Function is used for returning the date between a date and year from 0. It uses the Gregorian calendar dates. Syntax:- TO_DAYS(date) Example:- SELECT TO_DAYS(“2023-02-15”); Output:- 738931 WEEK Function:- WEEK Function is
Continue ReadingMySQL Date Or Time Function Part-7
SYSDATE Function:- SYSDATE Function is used to return the current server date and time. The format of the date and time will be “YYYY-MM-DD HH:MM: SS” (string) or as YYYYMMDDHHMMSS (numeric). Syntax:- SYSDATE() Example:- SELECT
Continue ReadingMySQL Date Or Time Function Part-6
PERIOD_ADD Function:- PERIOD_ADD Function is used for adding a specific number of months to a period. Its return format will be YYYYMM Syntax:- PERIOD_ADD(period, number) Example:- SELECT PERIOD_ADD(202203, 21); Output:- 202312 PERIOD_DIFF Function:- PERIOD_DIFF Function
Continue ReadingMySQL Date Or Time Function Part-5
LOCALTIME Function:- LOCALTIME Function is used for returning the current date and time. Return format will be YYYY-MM-DD HH-MM-SS” (string) or as YYYYMMDDHHMMSS.uuuuuu (numeric) Syntax:- LOCALTIME() Example:- SELECT LOCALTIME(); Output:- 2023-02-12 09:37:02 LOCALTIMESTAMP Function:- LOCALTIMESTAMP
Continue ReadingMySQL Date Or Time Function Part-4
DAYOFWEEK Function:- DAYOFWEEK Function is used for returning the weekday index from a given day. Weekday index 1 for Sunday, 2 for Monday, 3 for Tuesday, 4 for Wednesday, 5 for Friday, 6 for Saturday,
Continue ReadingMySQL Date Or Time Function Part-3
DATE_SUB Function:- DATE_SUB Function is used for returning the date after subtracting the date or time interval. Syntax:- DATE_SUB(date, INTERVAL value addunit) We can use following add Unit:- MICROSECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH,
Continue Reading