|
MySQL.RU - Webboard
Вернуться
Типы данных (Pavel) 16/10/2001 - 09:48:30
Re: int(255)-это предел.(+) (Anonymous) 16/10/2001 - 14:41:13
Re: А для SMALLINT или BIGINT ? (Pavel) 16/10/2001 - 15:38:00
Re: из Dynamic FAQ на mysql.com(+) (Oleggg) 17/10/2001 - 07:05:06
Re: Спасибо, осознал : ). (Anonymous) 18/10/2001 - 11:07:59
> Original message text:
> From: Pavel - 16/10/2001 - 09:48:30
> Subject:Типы данных
> -----------------
> Как понять тип поля INT(3)? Трёхзначное целое число, которое должно вписаться в INT ? А INT(20) уже будет ошибкой ?
> Подозреваю, что что-то недопонял.
>
From: Oleggg - 17/10/2001 - 07:05:06
Subject:из Dynamic FAQ на mysql.com(+)
-----------------
Summary: Column Types
Description:
MySQL supports a number of column types, which may be grouped intothree categories: numeric types, date and time types, and string (character)types. This section first gives an overview of the types available andsummarizes the storage requirements for each column type, then provides amore detailed description of the properties of the types in each category.The overview is intentionally brief. The more detailed descriptions shouldbe consulted for additional information about particular column types, suchas the allowable formats in which you can specify values.
The column types supported by MySQL are listed below.The following code letters are used in the descriptions:
M
Indicates the maximum display size. The maximum legal display size is 255.
D
Applies to floating-point types and indicates the number of digitsfollowing the decimal point. The maximum possible value is 30, butshould be no greater than M-2.
Square brackets (`[' and `]') indicate parts of type specifiersthat are optional.
Note that if you specify ZEROFILL for a column, MySQL willautomatically add the UNSIGNED attribute to the column.
TINYINT[(M)] [UNSIGNED] [ZEROFILL]
A very small integer. The signed range is -128 to 127. Theunsigned range is 0 to 255.
SMALLINT[(M)] [UNSIGNED] [ZEROFILL]
A small integer. The signed range is -32768 to 32767. Theunsigned range is 0 to 65535.
MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]
A medium-size integer. The signed range is -8388608 to8388607. The unsigned range is 0 to 16777215.
INT[(M)] [UNSIGNED] [ZEROFILL]
A normal-size integer. The signed range is -2147483648 to2147483647. The unsigned range is 0 to 4294967295.
INTEGER[(M)] [UNSIGNED] [ZEROFILL]
This is a synonym for INT.
BIGINT[(M)] [UNSIGNED] [ZEROFILL]
A large integer. The signed range is -9223372036854775808 to9223372036854775807. The unsigned range is 0 to18446744073709551615.Some things you should be aware about BIGINT columns:
As all arithmetic is done using signed BIGINT or DOUBLEvalues, so you shouldn't use unsigned big integers larger than9223372036854775807 (63 bits) except with bit functions! If youdo that, some of the last digits in the result may be wrong because ofrounding errors when converting the BIGINT to a DOUBLE.
You can always store an exact integer value in a BIGINT column bystoring it as a string, as there is in this case there will be nointermediate double representation.
`-', `+', and `*' will use BIGINT arithmetic whenboth arguments are INTEGER values! This means that if youmultiply two big integers (or results from functions that returnintegers) you may get unexpected results when the result is larger than9223372036854775807.
FLOAT(precision) [ZEROFILL]
A floating-point number. Cannot be unsigned. precision can be<=24 for a single-precision floating-point number and between 25and 53 for a double-precision floating-point number. These types are likethe FLOAT and DOUBLE types described immediately below.FLOAT(X) has the same range as the corresponding FLOAT andDOUBLE types, but the display size and number of decimals is undefined.In MySQL Version 3.23, this is a true floating-point value. Inearlier MySQL versions, FLOAT(precision) always has 2 decimals.Note that using FLOAT may give you some unexpected problems asall calculation in MySQL is done with double precision.See section 21.19 Solving Problems with No Matching Rows.This syntax is provided for ODBC compatibility.
FLOAT[(M,D)] [ZEROFILL]
A small (single-precision) floating-point number. Cannot be unsigned.Allowable values are -3.402823466E+38 to-1.175494351E-38, 0, and 1.175494351E-38 to3.402823466E+38. The M is the display width and D is thenumber of decimals. FLOAT without an argument or with an argument of<= 24 stands for a single-precision floating-point number.
DOUBLE[(M,D)] [ZEROFILL]
A normal-size (double-precision) floating-point number. Cannot beunsigned. Allowable values are -1.7976931348623157E+308 to-2.2250738585072014E-308, 0, and2.2250738585072014E-308 to 1.7976931348623157E+308. The Mis the display width and D is the number of decimals. DOUBLEwithout an argument or FLOAT(X) where 25 <= X <= 53 stands for adouble-precision floating-point number.
DOUBLE PRECISION[(M,D)] [ZEROFILL]
REAL[(M,D)] [ZEROFILL]
These are synonyms for DOUBLE.
DECIMAL[(M[,D])] [ZEROFILL]
An unpacked floating-point number. Cannot be unsigned. Behaves like aCHAR column: ``unpacked'' means the number is stored as a string,using one character for each digit of the value. The decimal point and,for negative numbers, the `-' sign, are not counted in M (but spacefor these are reserved). If D is 0, values will have no decimalpoint or fractional part. The maximum range of DECIMAL values isthe same as for DOUBLE, but the actual range for a givenDECIMAL column may be constrained by the choice of M andD.If D is left out it's set to 0. If M is left out it's set to 10.Note that in MySQL Version 3.22 the M argument had toincludes the space needed for the sign and the decimal point.
NUMERIC(M,D) [ZEROFILL]
This is a synonym for DECIMAL.
DATE
A date. The supported range is '1000-01-01' to '9999-12-31'.MySQL displays DATE values in 'YYYY-MM-DD' format, butallows you to assign values to DATE columns using either strings ornumbers. See section 7.3.3.2 The DATETIME, DATE, and TIMESTAMP Types.
DATETIME
A date and time combination. The supported range is '1000-01-0100:00:00' to '9999-12-31 23:59:59'. MySQL displaysDATETIME values in 'YYYY-MM-DD HH:MM:SS' format, but allows youto assign values to DATETIME columns using either strings or numbers.See section 7.3.3.2 The DATETIME, DATE, and TIMESTAMP Types.
TIMESTAMP[(M)]
A timestamp. The range is '1970-01-01 00:00:00' to sometime in theyear 2037. MySQL displays TIMESTAMP values inYYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD, or YYMMDDformat, depending on whether M is 14 (or missing), 12,8, or 6, but allows you to assign values to TIMESTAMPcolumns using either strings or numbers. A TIMESTAMP column is usefulfor recording the date and time of an INSERT or UPDATEoperation because it is automatically set to the date and time of the mostrecent operation if you don't give it a value yourself. You can also set itto the current date and time by assigning it a NULL value. See section 7.3.3 Date and Time Types.A TIMESTAMP is always stored in 4 bytes. The M argument onlyaffects how the TIMESTAMP column is displayed.Note that TIMESTAMP(X) columns where X is 8 or 14 are reported tobe numbers while other TIMESTAMP(X) columns are reported to bestrings. This is just to ensure that one can reliably dump and restorethe table with these types!See section 7.3.3.2 The DATETIME, DATE, and TIMESTAMP Types.
TIME
A time. The range is '-838:59:59' to '838:59:59'
Solution: NONE
Attached file: NONE
[Это сообщение - спам!]
Последние сообщения из форума
Уважаемые посетители форума MySQL.RU!
Убедительная просьба, прежде чем задавать свой вопрос в этом форуме, обратите внимание на разделы:
- ответы на наиболее часто задаваемые вопросы - FAQ
- раздел документация
- раздел поиск по сообщениям форума и документации
Также, старайтесь наиболее подробно указывать свою ситуацию (версию операционной системы, версию MySQL,
версию программного обеспечения, по которому возникает вопрос, текст возникающих ошибок, и др.)
Помните, чем конкретнее Вы опишете ситуацию, тем больше шансов получить реальную помощь.
374
|
|