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

잔글 (봇: 자동으로 텍스트 교체 (-<source +<syntaxhighlight , -</source> +</syntaxhighlight>))
 
(다른 사용자 한 명의 중간 판 하나는 보이지 않습니다)
3번째 줄: 3번째 줄:


==실행예시 1==
==실행예시 1==
<source lang='console'>
<syntaxhighlight lang='mysql' run>
mysql> DESC employee;
DESC employee
+------------+-------------+------+-----+---------+----------------+
</syntaxhighlight>
| Field      | Type        | Null | Key | Default | Extra          |
<syntaxhighlight lang='mysql' run>
+------------+-------------+------+-----+---------+----------------+
DESC Northwind.Category
| id        | int(11)    | NO  | PRI | NULL    | auto_increment |
</syntaxhighlight>
| first_name | varchar(32) | NO  |    | NULL    |                |
| last_name  | varchar(32) | NO  |    | NULL    |                |
+------------+-------------+------+-----+---------+----------------+
</source>


==실행예시 2==
==실행예시 2==
<source lang='console'>
<syntaxhighlight lang='console'>
mysql> DESC wp_links;
mysql> DESC wp_links;
+------------------+---------------------+------+-----+---------------------+----------------+
+------------------+---------------------+------+-----+---------------------+----------------+
34번째 줄: 30번째 줄:
| link_rss        | varchar(255)        | NO  |    |                    |                |
| link_rss        | varchar(255)        | NO  |    |                    |                |
+------------------+---------------------+------+-----+---------------------+----------------+
+------------------+---------------------+------+-----+---------------------+----------------+
</source>
</syntaxhighlight>


==실습==
==실습==
<source lang='console'>
<syntaxhighlight lang='console'>
mysql> CREATE TABLE dept (
mysql> CREATE TABLE dept (
     ->  dept_no INT(11) unsigned NOT NULL,
     ->  dept_no INT(11) unsigned NOT NULL,
43번째 줄: 39번째 줄:
     -> );
     -> );
Query OK, 0 rows affected (0.07 sec)
Query OK, 0 rows affected (0.07 sec)
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
mysql> DESC dept;
mysql> DESC dept;
+-----------+------------------+------+-----+---------+-------+
+-----------+------------------+------+-----+---------+-------+
53번째 줄: 49번째 줄:
+-----------+------------------+------+-----+---------+-------+
+-----------+------------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
2 rows in set (0.00 sec)
</source>
</syntaxhighlight>


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

2021년 7월 28일 (수) 17:00 기준 최신판

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

1 실행예시 1[ | ]

DESC employee
DESC Northwind.Category

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 }}