Bharanikumar
Bharanikumar

Reputation: 25733

mysql phpmyadmin accepting 4 character but its real length is int 2

i have employee table and its empid length is INT 3 ,

But it accepting more then 3 character ....

How it is possible

(THIS IS TESTED IN PHPMYADMIN)

Upvotes: 3

Views: 419

Answers (1)

Felix Kling
Felix Kling

Reputation: 816394

To cite the documentation: 10.2. Numeric Types

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 may be used by applications to display integer values having a width less than the width specified for the column by left-padding them with spaces. (That is, this width is present in the metadata returned with result sets. Whether it is used or not is up to the application.)

and

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

So you see, it is not a restriction that influences the data stored in MySQL but an additional information for applications that retrieve the data.

Upvotes: 6

Related Questions