"MySQL 테이블 구조 보기 DESCRIBE"의 두 판 사이의 차이

4번째 줄: 4번째 줄:
==실행예시 1==
==실행예시 1==
<source lang='cli'>
<source lang='cli'>
mysql> DESC employee;
mysql> CREATE TABLE dept (
+------------+-------------+------+-----+---------+----------------+
    ->  dept_no INT(11) unsigned NOT NULL,
| Field     | Type       | Null | Key | Default | Extra         |
    ->  dept_name VARCHAR(32) NOT NULL
+------------+-------------+------+-----+---------+----------------+
    -> );
| id        | int(11)     | NO  | PRI | NULL    | auto_increment |
Query OK, 0 rows affected (0.07 sec)
| first_name | varchar(32) | NO  |    | NULL    |               |
</source>
| last_name  | varchar(32) | NO  |    | NULL    |               |
<source lang='cli'>
+------------+-------------+------+-----+---------+----------------+
mysql> DESC dept;
+-----------+------------------+------+-----+---------+-------+
| Field     | Type             | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+-------+
| dept_no  | int(11) unsigned | NO  |    | NULL    |       |
| dept_name | varchar(32)     | NO  |    | NULL    |       |
+-----------+------------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
</source>
</source>



2015년 11월 4일 (수) 11:36 판

DESCRIBE; DESC, EXPLAIN
MySQL 테이블 구조 보기, 테이블 구조 확인

1 실행예시 1

mysql> CREATE TABLE dept (
    ->   dept_no INT(11) unsigned NOT NULL,
    ->   dept_name VARCHAR(32) NOT NULL
    -> );
Query OK, 0 rows affected (0.07 sec)
mysql> DESC dept;
+-----------+------------------+------+-----+---------+-------+
| Field     | Type             | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+-------+
| dept_no   | int(11) unsigned | NO   |     | NULL    |       |
| dept_name | varchar(32)      | NO   |     | NULL    |       |
+-----------+------------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

2 실행예시 2

mysql> DESC wp_links;
+------------------+---------------------+------+-----+---------------------+----------------+
| Field            | Type                | Null | Key | Default             | Extra          |
+------------------+---------------------+------+-----+---------------------+----------------+
| link_id          | bigint(20) unsigned | NO   | PRI | NULL                | auto_increment |
| link_url         | varchar(255)        | NO   |     |                     |                |
| link_name        | varchar(255)        | NO   |     |                     |                |
| link_image       | varchar(255)        | NO   |     |                     |                |
| link_target      | varchar(25)         | NO   |     |                     |                |
| link_description | varchar(255)        | NO   |     |                     |                |
| link_visible     | varchar(20)         | NO   | MUL | Y                   |                |
| link_owner       | bigint(20) unsigned | NO   |     | 1                   |                |
| link_rating      | int(11)             | NO   |     | 0                   |                |
| link_updated     | datetime            | NO   |     | 0000-00-00 00:00:00 |                |
| link_rel         | varchar(255)        | NO   |     |                     |                |
| link_notes       | mediumtext          | NO   |     | NULL                |                |
| link_rss         | varchar(255)        | NO   |     |                     |                |
+------------------+---------------------+------+-----+---------------------+----------------+

3 같이 보기

4 참고 자료

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