11/4/2023 0 Comments Mysql date functions cheat sheetSUM(expr) - Calculate the sum of values.COUNT(expr) - Count the number of rows.CASE - Perform conditional logic within a query.IF(expr, true_value, false_value) - Return one value if a condition is true, and another if it's false.DATE_SUB(date, INTERVAL expr unit) - Subtract an interval from a date or datetime.DATE_ADD(date, INTERVAL expr unit) - Add an interval to a date or datetime.TIMESTAMPDIFF(unit, datetime1, datetime2) - Calculate the difference between two timestamps.DATE_FORMAT(date, format) - Format a date as a string.AVG(expr) - Calculate the average of values in a column.SUM(expr) - Calculate the sum of values in a column.) - Find the minimum value in a set of expressions. ) - Find the maximum value in a set of expressions. RAND() - Generate a random number between 0 and 1.FLOOR(x) - Round down to the nearest integer. CEIL(x) - Round up to the nearest integer.ROUND(x, d) - Round a number to a specified number of decimal places.ABS(x) - Get the absolute value of a number.RIGHT(str, length) - Get a specified number of characters from the right of a string.LEFT(str, length) - Get a specified number of characters from the left of a string.REPLACE(str, from_str, to_str) - Replace occurrences of a substring in a string.TRIM(str) - Remove leading and trailing spaces from a string.LENGTH(str) - Get the length of a string.SUBSTRING(str, start, length) - Extract a substring from a string.LOWER(str) - Convert a string to lowercase.UPPER(str) - Convert a string to uppercase.MULTIPOLYGON - Collection of polygonal shapes.įunction - Common Function String Functions.GEOMETRYCOLLECTION - Collection of geometric objects.POLYGON - Polygonal shape in a two-dimensional space.LINESTRING - Curve in a two-dimensional space.POINT - Point in a two-dimensional space.GEOMETRY - Geometric objects (points, lines, polygons, etc.).MEDIUMBLOB - Medium binary large object.ENUM - Enumerated type (a list of values).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |