카테고리 없음2019. 8. 26. 15:19

MariaDB [firstdb]> create table test2 (col1 int(11) unsigned not null);
Query OK, 0 rows affected (0.048 sec)

MariaDB [firstdb]> show columns from test2;
+-------+------------------+------+-----+---------+-------+
| Field | Type             | Null | Key | Default | Extra |
+-------+------------------+------+-----+---------+-------+
| col1  | int(11) unsigned | NO   |     | NULL    |       |
+-------+------------------+------+-----+---------+-------+
1 row in set (0.036 sec)

 

테이블 생성시 컬럼 속성에 unsigned를 부여할 수 있다. 이 것은 컬럼의 활용도에 따라 범위를 다르게 주는 것이다.

양수만 존재하는 데이터라고 하면 unsigned를 붙여서 양수의 데이터 범위를 넓힐 수 있다.

unsigned가 붙지 않은 컬럼 : -2147483648 ~2147483647

unsigned가 붙은 컬럼 : 0 ~ 4294967295

 

Posted by 자수성가한 부자