For which, in the INT(size) parameter, the size of the table should be indicated.



  • What do you need to indicate the size in the INT(size) parameter when setting the table? Is that the size of the permitted symbols that will be recorded in the column? Who cares if I write,

    That's right.

    create table MyTest2(id_use int (1) AUTO_INCREMENT,
                        position5 varchar(10) NOT NULL DEFAULT '0',
                        PRIMARY KEY (id_use));
    

    or

    create table MyTest2(id_use int (100) AUTO_INCREMENT,
                        position5 varchar(10) NOT NULL DEFAULT '0',
                        PRIMARY KEY (id_use));
    


  • Most of the answers to these questions are in the documentation.

    As an extension of the ANSI/ISO SQL92 MySQL, it is possible to indicate, if necessary, the number of symbols supplied to the user of the whole number. This non-mandatory indication of the number of deleted symbols is used to supplement the left-hand values that contain symbols less than the specified width of the column, but does not limit either the range of values that can be stored in the column or the number of discharges that can be derived for values where the number of symbols exceeds the width of the column. If the non-mandatory ZEROFILL attribute is added, the free default positions are filled with zeros. For example, for a column declared as INT(5) ZEROFILL, value 4 is recovered as 00004.

    It should be borne in mind that if the whole cell column contains a value with a number of symbols exceeding the intended width of the column, there may be problems when MySQL generates time tables for some complex connections, as in such cases MySQL believes that the data were indeed a pole of the existing width.

    http://phpclub.ru/mysql/doc/numeric-types.html




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2