Value range and mathematical functions of various fields in mysql

zhaozj2021-02-16  53

MySQL in a variety of fields ranging from paper by: Author: (2001-07-05 17:04:01)

TINYINT -128 - 127 TINYINT UNSIGNED 0 - 255 SMALLINT -32768 - 32767 SMALLINT UNSIGNED 0 - 65535 MEDIUMINT -8388608 - 8388607 MEDIUMINT UNSIGNED 0 - 16777215 INT or INTEGER -2147483648 - 2147483647 INT UNSIGNED or INTEGER UNSIGNED 0 - 4294967295 BIGINT -9223372036854775808 - 9223372036854775807 BIGINT UNSIGNED 0 - 18446744073709551615 FLOAT -3.402823466E 38 - -1.175494351E-38 0 1.175494351E-38 - 3.402823466E 38 DOUBLE or DOUBLE PRECISION or REAL -1.7976931348623157E 308 - -2.2250738585072014E-308 0 2.2250738585072014E-308 - 1.7976931348623157E 308 DECIMAL [(M, [D])] or NuMERIC (M, D) by m (the length of the entire number, including the number of digits, the number of digits on the left side, the number of digits on the right side, but does not include the negative) And D (number of digits on the right side) is determined, M default is 10, D default is 0 DATE 1000-01-01 - 9999-12-31 datetime 1000-01-01 00:00:00 - 9999-12 -31 23:59:59 TimeStamp 1970-01-01 00:00:00 - 2037 a day (which day I don't know, huh, huh) Time -838: 59: 59 to 838: 59: 59 Year [(2 | 4)] The default is 4-bit format, 4-bit format ranges from 1901 - 2155,0000, 2-bit format range from 70-69 (1970-2069) char (m) [binary] Or nchar (m) [binary] m ranges from 1 - 255, if there is no binary item, it is not divided Write, nchar means using the default character set. In the database, it is made of space, but the space at the end of the time will be automatically removed. [National] VARCHAR (M) [binary] m range 1 - 255. In the database The space at the end of the middle will be automatically removed. Tinyblob or Tinytext 255 (2 ^ 8-1) characters BLOB or TEXT 65535 (2 ^ 16-1) characters Mediumblob or MediumText 16777215 (2 ^ 24-1) characters Longblob or Longtext 4294967295 (2 ^ 32-1) character enum ('Value1', 'Value2', ...) can have a total of 65535 different values ​​set ('Value1', 'Value2', ...) has up to 64 member

Mysql mathematical functions-yourself article comes from: http: //linuxdb.yeah.net Author: Yan Zi (2001-07-05 16:10:00)

All mathematical functions returns NULL in an error. - Single grading. Change the symbol of the parameters. MySQL> SELECT - 2; Note, if this operator is used with a Bigint, the return value is a Bigint! This means you should avoid using -, then there is a value -2 ^ 63! ABS (x) returns an absolute value of X. MySQL> SELECT ABS (2); -> 2 mysql> select abs (-32); -> 32 This feature is safe for the Bigint value. Sign (x) returns the symbol of the parameter, is -1, 0 or 1, depending on whether the X is negative, zero or positive. MySQL> SELECT SIGN (-32); -> -1 mysql> Select Sign (0); -> 0 mysql> SELECT SIGN (234); -> 1 mod (n, m)% mode (% of the% in C symbol). Returns the remainder of N by M. MySQL> SELECT MOD (234, 10); -> 4 MySQL> SELECT 253% 7; -> 1 mysql> select mod (29, 9); -> 2 This function is safe for the Bigint value. FLOOR (X) returns the maximum integer value of not more than X. MySQL> SELECT FLOOR (1.23); -> 1 mysql> select floor (-1.23); -> -2 Note The return value is transformed into a Bigint! CEILING (X) returns the minimum integer value of not less than X. MySQL> Select CEILING (1.23); -> 2 mysql> select ceiling (-1.23); -> -1 Note The return value is converted to a Bigint! Round (x) Returns an integer of the four rounds of parameter x. MySQL> SELECT ROUND (-1.23); -> -1 mysql> Select round (-1.58); -> -2 mysql> select round (1.58); -> 2 Note The return value is converted to a Bigint! Round (X, D) Returns a number of D a decimal number with a quarter-round parameter x. If D is 0, the result will not be a decimal point or a fractional portion. MySQL> SELECT ROUND (1.298, 1); -> 1.3 mysql> Select Round (1.298, 0); -> 1 Note The return value is transformed into a Bigint! EXP (x) return value e (bottom of the natural logarithm) X party. MySQL> SELECT Exp (2); -> 7.389056 MySQL> SELECT Exp (-2); -> 0.135335 LOG (X) Returns the natural logarithm of x. MySQL> SELECT log (2); -> 0.693147 mysql> select log (-2); -> NULL If you want a logarithm of any bottom B, using formula log (x) / log (b). LOG10 (X) Returns the log of X at 10 as the bottom. MySQL> SELECT log10 (2); -> 0.301030 mysql> select log10 (100); -> 2.000000 mysql> select log10 (-100); -> Null Pow (x, y) Power (x, y) Return Value x Y power.

转载请注明原文地址:https://www.9cbs.com/read-18732.html

New Post(0)