MySQL修改、删除表的结构
生活随笔
收集整理的這篇文章主要介紹了
MySQL修改、删除表的结构
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
MySQL修改、刪除表的結(jié)構(gòu)
1、增加一列
alter table student add score double(3,1);
說明
double(3,1)指數(shù)據(jù)是三位,小數(shù)部分占一位,整數(shù)部分占兩位,默認(rèn)最后一列
alter ?table student add score double (5,2) first
在第一列插入score
alter ?table student add score double(5,2) after enterdate;
在enterdate后插入
3、刪除一列
alter table student drop score;
4、修改一列,列名不變
alter table student modify score float(2,1);
update student set score = 3.45 where sno =2 ;
修改一列,列名改變
alter table student change score score2 double(3,1);
5、修改表名
alter table student rename to stu;
6、查看表的結(jié)構(gòu)
desc student;
7、刪除數(shù)據(jù)庫(kù)表
drop table student;
?
總結(jié)
以上是生活随笔為你收集整理的MySQL修改、删除表的结构的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 为什么自己编写的页面总是在那里抖动_别克
- 下一篇: element手机验证格式_Larave