mysql 高级查询二

各种show
show columns from my_student;
show grants for root;
show aviables;
show processlist;
show table status
============================
alter table my_class add id varchar(10);
alter table my_class change id id varchar(10) first;
alter table my_class change class room varchar(10);
truncate my_class;
insert into my_class values('1','Java01','A101'),('2','Python01','B101');
insert into my_class (id,name,room) value ('3','Java02','B203');
update my_student set c_id='3' where name in ('Tom','Lily','张三');
update my_student set c_id='1' where name in ('Lucy','Anthony');
update my_student set c_id='2' where name ='李四';
select * from my_student inner join my_class on my_student.c_id=my_class.id;
select * from my_student inner join my_class on c_id = my_class.id;
select s.*,c.name as c_name,c.room from my_student as s inner join my_class as c on s.c_id=c.id;
select s.*,c.name as c_name,c.room from my_student as s inner join my_class as c where s.c_id=c.id;

原文地址:https://www.cnblogs.com/51testing/p/8296091.html