PyQt5 獲取電腦螢幕桌面的寬、高
阿新 • • 發佈:2021-01-09
一、知識
有時候,我們需要對某列資料做簡單處理。(求和,求平均、取最大、取最小等)就需要用到聚集函式。聚集函式有如下5個。
AVG()//取平均
COUNT()//取這一列的專案的數量
MAX()//取這一列的最大值
MIN()//取這一列的最小值
SUM()//取這一列之和
試舉一例:
select avg(prod_price)
as avg_price
from tyqsl2.products
再舉一例:
SELECT count(*) as numbers_of_items,
avg(prod_price) as avg_price,
max (prod_price) as max_price,
min(prod_price) as min_price
FROM tyqsl2.products;
二、課後習題
SELECT sum(quantity)
FROM tyqsl2.orderitems;
SELECT sum(quantity)
FROM tyqsl2.orderitems
where prod_id = 'BR01'
select max(prod_price)
as special_price
from tyqsl2.products
where prod_price <= 10