Malcolm Dew-Jones 寫道:
> howachen@gmail.com wrote:
>
> : Bill Karwin wrote:
> : > howachen@gmail.com wrote:
> : > > why we need to use in real life?
> : >
> : > The only time I have used the display width is when I'm also using the
> : > ZEROFILL modifier.
> : >
> : > CREATE TABLE foo ( i INT(6) ZEROFILL );
> : > INSERT INTO foo VALUES (42);
> : > SELECT i FROM foo;
> : >
> : > Outputs: 000042
> : >
> : > Regards,
> : > Bill K.
>
> : oic, that's mean without using ZEROFILL, it is useless to set the
> : display width...it was funny that many books/reference/web sites used
> : display width but in fact they are useless in real life...
>
> It is useless in mysql only because mysql doesn't use it. The syntax is
> most likely accepted for compatibility with the SQL language.
>
> In other databases the size of the column would restrict the size of data
> that is allowed. If you declared an integer of four digits and tried to
> save a number that required 5 digits then you would get an error
> indicating the number was too large.
is this part of the ANSI SQL standard?
which other database use display width as size restriction?