Mysql修改表備註, 列資訊

2022-03-18 12:03:06 字數 807 閱讀 2850

1、新增表和字段的注釋

建立資料表的同時,給表和字段新增注釋

--

建立使用者資訊表

create

table

tb_user

( id

int auto_increment primary

key comment '編號'

, name

varchar(30) comment '姓名'

)comment ='

使用者資訊表

';

2、修改表注釋

alter

table tb_user comment '

使用者資訊表2

';

3、修改字段注釋

alter

table tb_user modify column name varchar(30) not

null comment '

姓名2';

注意:修改時要把該字段的完整定義寫上,如欄位型別、屬性等。千萬不要因為只是為了修改乙個注釋,而把該字段定義的其它屬性給覆蓋掉了。

4、查詢字段資訊

show full columns from tb_user;

5、修改列名

alter

table m_facerecognitioninfo change cardswiperesult cardswiperesult varchar(32) comment '

刷卡結果

';

Mysql修改約束,列資訊,表資訊

修改資料表 新增單列 alter table tbl name add column col name column definition first after column 預設在末尾 例如在usename後面新增列 alter table users1 add password varchar...

MySQL查詢備註資訊

在mysql下執行完下面這個建表語句後。如何從資料字典中,檢索出這個表的字段的相關資訊?drop table if exists test table create table test table test id int not null auto increment primary key co...

mysql修改表和列

mysql增加列,修改列名 列屬性,刪除列語句 mysql修改表名,列名,列型別,新增表列,刪除表列 alter table test rename test1 修改表名 alter table test add column name varchar 10 新增表列 alter table tes...