MySQL | 实验楼课程学习笔记5

174 阅读1分钟
  1. 删除数据库
drop database <数据库名>
  1. 删除一张表
drop table <表名>
  1. 重命名一张表
rename table <原表名> to <新表名>

或者是

alter table <原表名> rename <新表名>
  1. 增加一列
alter table <表名> add column 列名 数据类型 约束
//aleter table employee add column height int(4) default 170
  1. 删除一列
alter table <表名> drop <列名>;
  1. 删除一行
delete from <表名> where <条件>
  1. 重命名列名
alter table <表名> change <原列名> <新列名> 数据类型 约束
  1. 修改表中某个值
update 表名 set 属性名=属性值,属性名=属性值 where 条件