INT(M) - Co je vlastne M-ko

INT(M) - co vlastne znamena "M"
citujem manual:
"M indicates the number of bits per value, from 1 to 64."
No ano , ale ako to mam chapat pisu ze 64 ale databaza zoberie aj INT(255) tak preco pisu ze 64.

INT UNSIGNED ma rozsah "The unsigned range is 0 to 4294967295."
1.) ak mam INT(1) tak maximalne ma pusti vlozit "4294967295"
2.) ak mam INT (100) tak tiez maximalne ma pusti vlozit "4294967295"
3.) ak mam INT(255) tak to iste

Aky vlastne ma vyznam to cislo v zatvorke (kedze maximum v jednotlivych pripadoch sa nemeni)? Ake by som ho mal davat?


PS:
The unsigned range for SMALLINT is 0 to 65535.
Ako sa to vlastne pocita? Preco prave 65535? Mohol by niekto rozpisat operacie akymi sa dostanem k prave tomu cislo. Vdaka
INT predstavuje 4 bajty coz znamena, ze maximalni mozne cislo je 4294967295. Nad touto hodnotou INT selze.
To same plati i u SMALLINT. Ten ma 2 bajty, takze max je 65535.

Jak se k tomu prislo? Jednoducha matika INT: 4 bajty = 32 bitu. A vsechny mozne binarni kombinace o delce 32 bitu pak predstavuje 2^32 = 4294967296 cisel. Jelikoz se zapocitava i nula, pak je maximalni cislo odecteno o 1. V pripade signed zapisu jde pak o rozdeleni na pulky - 1 pulka zaporna a druha pulka kladna.
2^32
32 je uz jasne. ALe preco prave 2 ?

Inak kolko bitov treba na ulozenie nejakeho cisla, napriklad "0" alebo napriklad "1" atd az "9"
Ak do INT UNSIGNED vlozim zaznam tak mysql stale ma rovnakou velikost pro dany zaznam? Teda ak vlozim jenom "1" tak velikost bude mit stejnou jako ked vlozim "4294967296"
jinak receno ta citace rika, ze maximalni pocet ruznych cisel (hodnot) je 2^M
este toto nemam vysvetlene:
INT UNSIGNED ma rozsah "The unsigned range is 0 to 4294967295."
1.) ak mam INT(1) tak maximalne ma pusti vlozit "4294967295"
2.) ak mam INT (100) tak tiez maximalne ma pusti vlozit "4294967295"
3.) ak mam INT(255) tak to iste

Uz som nasiel na to vysvetlenie, len si ho neviem logicky vysvetlit/prelozit:

(for example, INT(4)). This optional display width is used to display integer values having a width less than the width specified for the column by left-padding them with spaces.
to bude kvůli té SQL 92 kompatibilitě, sice to zapsat můžeš, ale nebere se na to zřetel, ne?
No zapsat to muzu, ale jestli to bere na zretel, tak to nevim, protoze nevim co to "M" vlastne znamena.

Tohle nevim nejak pochopit:
(for example, INT(4)). This optional display width is used to display integer values having a width less than the width specified for the column by left-padding them with spaces.

Tady to je komplet vysvetlene:

Another extension is supported by MySQL for optionally specifying the display width of integer data types in parentheses following the base keyword for the type (for example, INT(4)). This optional display width is used to display integer values having a width less than the width specified for the column by left-padding them with spaces.

The display width does not constrain the range of values that can be stored in the column, nor the number of digits that are displayed for values having a width exceeding that specified for the column. For example, a column specified as SMALLINT(3) has the usual SMALLINT range of -32768 to 32767, and values outside the range allowed by three characters are displayed using more than three characters.

Mohl by to nekdo nejak vysvetlit, lebo si s tim nemuzu rady. Nechapu ze kdys menim "M" a stajnak se rozsah hodnot kere muzu vlozit nemeni.