http://sample.jimstone.com.cn/xsql/

mysql -V
mysql -u user -p password mysql -u user -p password -P port -h host
show databases;
use database01;
select * from user;
select * from user where score>80;
select * from user where gender='男';
select * from user where students like '小%';
select * from user where students not like '小%;
select * from user where students like '%聪%';
select * from user where score in(98,60,92);
select * from user where score>95 or gender='女';
select * from user where user.id=user_ext.id;
select count() from user where scoe>60;
select avg(score) from user;
select sum(score) from user;获取总分后标题为“sum(score)” select sum(score) as 总分数 from user; 获取总分后标题为“总分数”
select max(score) from user;
select min(score) from user;
select distinct(age) as 年龄 from user_ext;
select _ from user_ext order by weight desc;倒序 select _ from user_ext order by weight asc;升序
select t1.id,t1.students,t1.age,t1.weight from user as t1 left join user_ext as t2 on t2.id=t1.id where t2.age>9;
update user set score=30 where students='小明';
insert into user(studens,score,gender) values('小白',30,'男');
delete from user where students='小明';
delete from user; truncate user; delete 与 truncate 清空数据表的区别
create table test(id int,students char,gender char);
drop table test;
alter table 旧表名 rename 新表名;
待补充
ALTER TABLE 表名 ADD COLUMN 字段名 字段类型 是否可为空 COMMENT '注释' AFTER 指定某字段 ; --COLUMN 关键字可以省略不写