查看MySQL版本的命令及常用命令
insert into <表名> [( <字段名1>[,..<字段名n > ])] values ( 值1 )[, ( 值n )] // 插入数据库表
select * from MyTest; // 查询 MyTest 表的所有数据
select <字段1,字段2,...> from MyTest where < 表达式 >; // 查询需要的字段
select * from MyTest order by id desc limit 0,10; // 查询前10行数据,按ID进行降序显示:默认为 asc-升序,desc 为降序
update MyTest set name='Mary' where id=1; // 修改表中数据
delete from MyTest where id=1; // 删除表中数据
drop table <表名>; // 删除数据库表
alter table MyTest add love vachar(20) ; // 添加字段 hobby
alter table MyTest add index test_name (name); // 添加索引
alter table MyTest add primary key(id); // 添加关键字索引
alter table MyTest add unique test_name2(name); // 添加唯一限制
alter table MyTest drop index test_name; // 删除某个索引
alter table MyTest change love hobby vachar(20); // 修改原有字段
alter table MyTest drop hobby; // 删除字段 hobby
Ctrl + C 快捷键 // 在 cmd 命令行模式下退出 MySQL 命令行
exit + 回车 // 退出 MySQL 客户端