왜 범위가 내 SQL 데이터 유형과 함께 제공되는지 궁금합니다. 필드 이름이 "id"이고 데이터 유형이 "int (2)"인 테이블을 정의합니다. 필드 "id"에 "123456"으로 값을 삽입했습니다. 이것은 승인되고 저장됩니다. 그래서 범위를 제공하는 용도는 무엇입니까?
미리 감사드립니다.
해결 방법
INT
및 속성이 표시되는 기타 숫자 유형의 경우 표시 너비 만 지정합니다.
MySQL은 다음에 대한 확장을 지원합니다. optionally specifying the display width of integer data types in parentheses following the base keyword for the type. For example, INT(4) specifies an INT with a display width of four digits. 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 응용 프로그램에 달려 있습니다.)
디스플레이 너비는 제한하지 않습니다. the range of values that can be stored in the column. Nor does it prevent values wider than the column display width from being displayed correctly. For example, a column specified as SMALLINT(3) has the usual SMALLINT range of -32768 to 32767, and values outside the range permitted by three digits are displayed in full using 세 자리 이상.
참조 페이지 https://stackoverflow.com/questions/5562322
'MySql' 카테고리의 다른 글
MySQL PHP에서 PDO 클래스로 num_rows를 얻는 문제 (0) | 2020.10.12 |
---|---|
MySQL 거대한 테이블의 MySQL 최적화 (0) | 2020.10.12 |
MySQL의 데이터베이스에서 모든 테이블 (모두 innodb)을 강제로 자르는 방법은 무엇입니까? (0) | 2020.10.12 |
MySQLi에서 참조로 매개 변수를 전달할 수 없습니다. (0) | 2020.10.12 |
MySQL 동일한 테이블에있는 다른 행의 데이터로 행 업데이트 (0) | 2020.10.12 |
댓글