1. 程式人生 > 資料庫 >【資料分析師_02_SQL+MySQL】016_MySQL的資料匯聚AVG,COUNT,MAX,MIN,SUM

【資料分析師_02_SQL+MySQL】016_MySQL的資料匯聚AVG,COUNT,MAX,MIN,SUM

MySQL的資料匯聚AVG,COUNT,MAX,MIN,SUM


沒啥好看的,簡單的很

1 AVG平均

select avg(prod_price) from products
where vend_id = 1003 ;

2 count計數

select count(*) as num_count from products ;

3 Max/Min 最大值/最小值

select max(prod_price) from products ;

select min(prod_price) from products ;

5 Sum求和

select sum(quantity) from orderitems where order_num = 20005 ;