请问 在mysql 中 创建表时
表字段加上注释 怎么查看 在 mysql Command line Client 中查看 如
create table users (
id int primary key auto_increment 这里怎样写字段注释 ,
userName varchar(20) not null
);
表字段加上注释 怎么查看 在 mysql Command line Client 中查看 如
create table users (
id int primary key auto_increment 这里怎样写字段注释 ,
userName varchar(20) not null
);
CREATE TABLE `abc` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ReporterName` varchar(50) NOT NULL COMMENT '此处写你的注释',
)
id int primary key auto_increment comment '主键',
userName varchar(20) not null
);
show create table 'tb' ;
或者
desc 'tb';
*************************** 1. row ***************************
Table: t
Create Table: CREATE TABLE t (
id INT(11) default NULL auto_increment,
s char(60) default NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM
-> (id int primary key comment 'this is primary key for demo',
-> col2 varchar(32));
Query OK, 0 rows affected (0.17 sec)mysql> show create table tcomment;
+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table
|
+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tcomment | CREATE TABLE `tcomment` (
`id` int(11) NOT NULL COMMENT 'this is primary key for demo',
`col2` varchar(32) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)