日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql修改_mysql修改表操作

發布時間:2023/11/29 数据库 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql修改_mysql修改表操作 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一: 修改表信息

1.修改表名

alter table test_a rename to sys_app;

2.修改表注釋

alter table sys_application comment '系統信息表';

二:修改字段信息

1.修改字段類型和注釋

alter table sys_application modify column app_name varchar(20) COMMENT '應用的名稱';

2.修改字段類型

alter table sys_application modify column app_name text;

3.設置字段允許為空

alter table sys_application modify column description varchar(255) null COMMENT '應用描述';

4.增加一個字段,設好數據類型,且不為空,添加注釋

alert table sys_application add `url` varchar(255) not null comment '應用訪問地址';

5.增加主鍵

alter table t_app add aid int(5) not null ,add primary key (aid);

6.增加自增主鍵

alter table t_app add aid int(5) not null auto_increment ,add primary key (aid);

7.修改為自增主鍵

alter table t_app modify column aid int(5) auto_increment ;

8.修改字段名字(要重新指定該字段的類型)

alter table t_app change name app_name varchar(20) not null;

9.刪除字段

alter table t_app drop aid;

10.在某個字段后增加字段

alter table `t_app` add column gateway_id int not null default 0 AFTER `aid`; #(在哪個字段后面添加)

11.調整字段順序

alter table t_app change gateway_id gateway_id int not null after aid ; #(注意gateway_id出現了2次)

總結

以上是生活随笔為你收集整理的mysql修改_mysql修改表操作的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。