Mysql 学习之路(三)Mysql基础知识之数据过滤

1.order_by

select * from products order_by salary desc;(倒叙)

select * from products order_by salary asc;

2.利用正则表达式

select * from products where name regexp ‘.000‘;

select * from products where name regexp ‘[123] 000‘;

3.利用函数

select upper(name) from products ;

select * from products where Year(order_date) = 2020 and Month(order_date) = 5;

select avg(salary) from products;(平均值)

select count(*) from products;(计数)

select max(salary) as min_salary from products;(最大值)

select sum(salary) as sum_salary from products;(求和)

 

Mysql 学习之路(三)Mysql基础知识之数据过滤

上一篇:java记录之数据库操作编写程序实现用户登录、注册、修改密码


下一篇:mysql数据库shell脚本实例