SUM??????

SUM ????????????????????????????????????????????????????????????????????????(?????? (????????????)??????????????????????????????) SUM???????????????????????????????????????????????????????????????????????????

??????

SUM ( [ DISTINCT | ALL ] ??? )

DISTINCT?????????ALL???????????????????????????????????????????????????????????????????????????ALL???DISTINCT?????????????????????????????????ALL???????????????????????????????????????????????????????????????1???1???1???1???2?????????????????????????????????SUM(col)???SUM(DISTINCT col)????????????????????????????????????

??????????????????DISTINCT????????????????????????????????????????????????????????????????????????????????????
SELECT AVG (DISTINCT flying_time), SUM (DISTINCT miles)
FROM Flights

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????NULL??????????????????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????(??????????????????????????????????????????????????????)

-- ???????????????????????????????????????????????????
SELECT SUM (economy_seats) FROM Airlines;

-- SUM?????????????????????????????????????????????
-- (????????????????????????????????????????????????)
SELECT SUM (economy_seats_taken + business_seats_taken + firstclass_seats_taken)
as seats_taken FROM FLIGHTAVAILABILITY;