"MySQL 컬럼 자료형 확인"의 두 판 사이의 차이

32번째 줄: 32번째 줄:
1 row in set (0.00 sec)
1 row in set (0.00 sec)
</source>
</source>
==방법 3: PHP==


==같이 보기==
==같이 보기==

2015년 6월 24일 (수) 11:12 판

MySQL 컬럼 자료형 확인

1 방법 1: SHOW COLUMNS

mysql> SHOW COLUMNS FROM `user` LIKE 'user_id';
+---------+------------------+------+-----+---------+----------------+
| Field   | Type             | Null | Key | Default | Extra          |
+---------+------------------+------+-----+---------+----------------+
| user_id | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
+---------+------------------+------+-----+---------+----------------+
1 row in set (0.00 sec)

2 방법 2: information_schema

mysql> SELECT DATA_TYPE FROM information_schema.COLUMNS WHERE TABLE_NAME='user' AND COLUMN_NAME='user_id';
+-----------+
| DATA_TYPE |
+-----------+
| int       |
+-----------+
1 row in set (0.00 sec)
mysql> SELECT COLUMN_TYPE FROM information_schema.COLUMNS WHERE TABLE_NAME='user' AND COLUMN_NAME='user_id';
+------------------+
| COLUMN_TYPE      |
+------------------+
| int(10) unsigned |
+------------------+
1 row in set (0.00 sec)

3 방법 3: PHP

4 같이 보기

5 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}