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;(求和)

 

posted @ 2020-05-31 14:06  peterWXM  阅读(132)  评论(0编辑  收藏  举报