답변:
DROP TABLE IF EXISTS test_comments;
Query OK, 0 rows affected (0.08 sec)
CREATE TABLE test_comments (ID INT, name CHAR(30)) COMMENT 'Hello World';
Query OK, 0 rows affected (0.22 sec)
테이블 구조에서 주석 확인
show create table test_comments\G
*************************** 1. row ***************************
Table: test_comments
Create Table: CREATE TABLE `test_comments` (
`ID` int(11) DEFAULT NULL,
`name` char(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Hello World'
1 row in set (0.00 sec)
아래와 같이 information_schema에서 주석을 확인할 수도 있습니다
SELECT TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_NAME = 'test_comments';
+---------------+
| TABLE_COMMENT |
+---------------+
| Hello World |
+---------------+
1 row in set (0.00 sec)
주석 수정 테이블 변경
ALTER TABLE test_comments COMMENT = 'This is just to test how to alter comments';
Query OK, 0 rows affected (0.08 sec)
Records: 0 Duplicates: 0 Warnings: 0
수정 된 의견 확인
show create table test_comments\G
*************************** 1. row ***************************
Table: test_comments
Create Table: CREATE TABLE `test_comments` (
`ID` int(11) DEFAULT NULL,
`name` char(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='This is just to test how to alter comments'
1 row in set (0.00 sec)
SELECT TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_NAME = 'test_comments';
+--------------------------------------------+
| TABLE_COMMENT |
+--------------------------------------------+
| This is just to test how to alter comments |
+--------------------------------------------+
1 row in set (0.00 sec)
column_comment
로부터 information_schema.columns
합니다 (이후 alter table ...
다시, 모든 열 정의를 지정할 필요)?