1.查询语句的基本操作 - select - from - where - group by - having - distinct - order by - limit - 聚合函数: count, max, min, avg, sum 2.单表查询: #前期表与数据准备 # 创建一张部门表 create table emp( id int not null unique auto_increment, name ) not null, sex enum('male','female') no…
查询指定字段 select 字段1,字段2 from 表名; 消除重复行(重复指的是结果集中的所有完全重复行) select distinct 字段1,字段2... from 表名 比较运算符(< > != = ) select * from 表名 where id>4 逻辑运算符(and or not in) select * from 表名 where id>4(条件1) and gender=1…
23个MySQL常用查询语句 一查询数值型数据: SELECT * FROM tb_name WHERE sum > 100; 查询谓词:>,=,<,<>,!=,!>,!<,=>,=< 二查询字符串 SELECT * FROM tb_stu WHERE sname = '小刘' SELECT * FROM tb_stu WHERE sname like '刘%' SELECT * FROM tb_stu WHERE sname like '%…
打开CMD,进入数据库命令:mysql -hlocalhost -uroot -p 退出数据库:exit 用户管理: 1.新建用户: >CREATE USER name IDENTIFIED BY 'ssapdrow'; 2.更改密码: >SET PASSWORD FOR name=PASSWORD('fdddfd'); 3.权限管理 >SHOW GRANTS FOR name; //查看name用户权限 >GRANT SELECT ON db_name.* TO name;…