Tinyint, Smallint, Mediumint, Int, Bigint,...

Superfly2k

Grünschnabel
Hallo zusammen,
ich stehe vor dem Problem das ich mit PHP MyAdmin eine neue Tabelle
machen will, da es soviele verschiedene Integer gibt weiss ich nicht
ob ich jetzt TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT oder sonst was
brauche, gibts da irgendwo eine Tabelle wo steht wieviel Bytes welcher
INT benötigt/verwenden kann ??

Danke für die Hilfe,

MfG Superfly
 
hi,
siehe doku :)

TINYINT[(M)] [UNSIGNED] [ZEROFILL]
A very small integer. The signed range is -128 to 127. The unsigned range is 0 to 255.
SMALLINT[(M)] [UNSIGNED] [ZEROFILL]
A small integer. The signed range is -32768 to 32767. The unsigned range is 0 to 65535.
MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]
A medium-size integer. The signed range is -8388608 to 8388607. The unsigned range is 0 to 16777215.
INT[(M)] [UNSIGNED] [ZEROFILL]
A normal-size integer. The signed range is -2147483648 to 2147483647. 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 to 9223372036854775807. The unsigned range is 0 to 18446744073709551615. Some things you should be aware about BIGINT columns:
As all arithmetic is done using signed BIGINT or DOUBLE values, so you shouldn't use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting the BIGINT to a DOUBLE. MySQL 4.0 can handle BIGINT in the following cases:
Use integers to store big unsigned values in a BIGINT column.
In MIN(big_int_column) and MAX(big_int_column).
When using operators (+, -, * etc) where both operands are integers.
You can always store an exact integer value in a BIGINT column by storing it as a string, as there is in this case there will be no intermediate double representation.
`-', `+', and `*' will use BIGINT arithmetic when both arguments are INTEGER values! This means that if you multiply two big integers (or results from functions that return integers) you may get unexpected results when the result is larger than 9223372036854775807
 
VARCHAR mit 15 Zeichen... eine IP kann maximal aus 12 Nummern bestehen + 3 Punkte dazwischen...

So hab ichs jedenfalls gemacht.....
 

Neue Beiträge

Zurück