数据库相关
# 创建数据库create database if not exits blog;-- 删除数据库drop database if not exits blog;-- 显示数据库show databases;-- 选择创建的数据库use blog;-- 显示表名show tables;-- 重命名表alter table articles rename article;-- 清空数据表delete from article;-- 清空数据表,且无法恢复truncate table article;
表相关
# 添加列alter table article add column `author` varchar(5) not null default '' after `title`;# 修改列名(重建表)alter table article change author authors;# 修改列属性(不重建表)alter table article modify `authors` varchar(10) not null default '' comment '';# 删除列alter table article drop authors;# 插入一行数据insert into `article` () values ();# 清空表数据,不清空表标识delete * from article;
