MySQL SUBTIME Function

Example

Subtract 5.000001 seconds and return the datetime:

SELECT SUBTIME("2017-06-15 10:24:21.000004", "5.000001");

Definition and Usage

The SUBTIME() function subtracts time from a time/datetime expression and then returns the new time/datetime.

Syntax

SUBTIME(datetime, time_interval)

Continue reading MySQL SUBTIME Function

MySQL DAYOFYEAR Function

Example

Return the day of the year for a date:

SELECT DAYOFYEAR("2017-06-15");

Definition and Usage

The DAYOFYEAR() function returns the day of the year for a given date (a number from 1 to 366). Continue reading MySQL DAYOFYEAR Function

MySQL DAYOFMONTH Function

Example

Return the day of the month for a date:

SELECT DAYOFMONTH("2017-06-15");

Definition and Usage

The DAYOFMONTH() function returns the day of the month for a given date (a number from 1 to 31).

Continue reading MySQL DAYOFMONTH Function

MySQL ADDTIME Function

Example

Add 2 seconds to a time and return the datetime:

SELECT ADDTIME("2017-06-15 09:34:21", "2");

Definition and Usage

The ADDTIME() function adds a time interval to a time/datetime and then returns the time/datetime. Continue reading MySQL ADDTIME Function

MySQL MIN Function

Example

Find the price of the cheapest product in the “Products” table:

SELECT MIN(Price) AS SmallestPrice FROM Products;

Definition and Usage

The MIN() function returns the minimum value in a set of values.

Note: See also the MAX() function. Continue reading MySQL MIN Function

MySQL DEGREES Function

Example

Convert the radian value into degrees:

SELECT DEGREES(1.5);

Definition and Usage

The DEGREES() function converts a value in radians to degrees.

Note: See also the RADIANS() and PI() functions. Continue reading MySQL DEGREES Function