Toon posts:

[MySQL + phpmyadmin] datatype int vraagje

Pagina: 1
Acties:

Verwijderd

Topicstarter
Hoi,

in mysql kun je bijvoorbeeld een SMALLINT(2) aanmaken. Toch kan een SMALLINT(11) slechts een evengroot (unsigned) getal bevatten als een SMALLINT(2) (32767). Mijn vraag is dan waarom het getal achter de haakjes dient.

  • Janoz
  • Registratie: Oktober 2000
  • Laatst online: 22:03

Janoz

Moderator Devschuur®

!litemod

Die staat er om iig de sql code compatible te houden met standaard SQL. Zoals je ook in de handleiding kunt zien (http://dev.mysql.com/doc/...umeric-type-overview.html) wordt de waarde voor integers helemaal niet gebruikt.

Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'


  • zwippie
  • Registratie: Mei 2003
  • Niet online

zwippie

Electrons at work

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

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.

How much can you compute with the "ultimate laptop" with 1 kg of mass and 1 liter of volume? Answer: not more than 10^51 operations per second on not more than 10^32 bits.