一、Mysql命令总结
1.创建库
create database test1;
2.授权一个用户
grant all privileges on *.* to 'feng'@'%' identified by '1qaz@WSX';
3.创建表
create table Teacher(
teaId int not null,
teaname varchar(100),
age int,
sex enum('M', 'F'),
phone int);
4.查询
select * from tabel_name where 条件1 and 条件2
5.增加
insert into table_name (id, name, age, sex, grander) values (1, 'feng', 30, 'M', 99), (2, 'ajing', 45, 'F', 88);
6.修改
update table_name set id=10 where 条件判断
7.删除
delete from table_name where 条件判断
drop table table_name
8.联合查询
select a.id, b.name from A a join B b on a.id=b.tid
9.创建索引
create index idx_库名_表名_列名1_列名2 (列名1, 列名2)
10.查看sql是否走索引
explain sele