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

잔글 (봇: 자동으로 텍스트 교체 (-<source lang='cli'> +<source lang='console'>))
3번째 줄: 3번째 줄:


==실행예시 1==
==실행예시 1==
<source lang='cli'>
<source lang='console'>
mysql> DESC employee;
mysql> DESC employee;
+------------+-------------+------+-----+---------+----------------+
+------------+-------------+------+-----+---------+----------------+
15번째 줄: 15번째 줄:


==실행예시 2==
==실행예시 2==
<source lang='cli'>
<source lang='console'>
mysql> DESC wp_links;
mysql> DESC wp_links;
+------------------+---------------------+------+-----+---------------------+----------------+
+------------------+---------------------+------+-----+---------------------+----------------+
37번째 줄: 37번째 줄:


==실습==
==실습==
<source lang='cli'>
<source lang='console'>
mysql> CREATE TABLE dept (
mysql> CREATE TABLE dept (
     ->  dept_no INT(11) unsigned NOT NULL,
     ->  dept_no INT(11) unsigned NOT NULL,
44번째 줄: 44번째 줄:
Query OK, 0 rows affected (0.07 sec)
Query OK, 0 rows affected (0.07 sec)
</source>
</source>
<source lang='cli'>
<source lang='console'>
mysql> DESC dept;
mysql> DESC dept;
+-----------+------------------+------+-----+---------+-------+
+-----------+------------------+------+-----+---------+-------+

2016년 3월 29일 (화) 10:47 판

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

1 실행예시 1

mysql> DESC employee;
+------------+-------------+------+-----+---------+----------------+
| Field      | Type        | Null | Key | Default | Extra          |
+------------+-------------+------+-----+---------+----------------+
| id         | int(11)     | NO   | PRI | NULL    | auto_increment |
| first_name | varchar(32) | NO   |     | NULL    |                |
| last_name  | varchar(32) | NO   |     | NULL    |                |
+------------+-------------+------+-----+---------+----------------+

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 실습

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)

4 같이 보기

5 참고 자료

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