COUNT takes the name of a column(s) as an argument and counts the number of rows where the value(s) is not NULL.
GROUP BY is a clause used with aggregate functions to combine data from one or more columns.
SUM() takes the column name as an argument and returns the sum of all the values in that column.
MAX() takes the column name as an argument and returns the largest value in that column.
MIN() takes the column name as an argument and returns the smallest value in that column.
AVG() takes a column name as an argument and returns the average value for that column.
ROUND() takes two arguments, a column name and the number of decimal places to round the values in that column.
Learn SQL
今回はデータの集計関係のコードを学習しました。
COUNTは、引数として列の名前を取得し、値がNULLでない行の数をカウントする。
GROUP BYは、複数列からのデータを結合する集計関数で使用される構文である。
SUM()は引数として列の名前を取得し、その列のすべての値の合計を返す。
MAX()は引数として列の名前を取得し、その列の最大値を返す。
MIN()は引数として列の名前を取得し、その列の最小値を返す。
AVG()は引数として列の名前を取得し、その列の平均値を返す。
ROUND()は、二つの引数を取得し、列の名前とその列の値を四捨五入し小数点以下の桁数を取ります。
こんな感じかな?
わからなかった単語
aggregate (形) 合計の、全体としての、総合した
aggregate (名) 集合、通算
aggregate (動) 集める、組み合わせる、結びつける、合する
aggregate function(名)集計関数《表計算ソフトで, ある列(など)のすべてのデータについて作用する関数; 平均, 合計, 最大値など》
readable (形) 見やすい、鮮やかな、明確な
round(動) 四捨五入する、非難する、回る、一周する
round
【形容詞】
丸める; ラウンド; 丸い
いわゆる「丸める」というもので,具体的には,切捨てる(round down),切り上げる(round up),四捨五入する(round off)がある.プログラム作成において,計算処理の部分で考慮すべきことの一つである.
位取り表現において,1個以上の数字を最下位から削除又は省略し,残りの部分をある指定された規則に従って調整すること.
〈注〉1)丸めの目的は,通常,数表示の精度を限定すること,数表示における文字数を減らすこと,又はその両者である.2)算術における最も一般的な丸め方は,切捨て,切上げ及び四捨五入である.
用例
the computer rounds the value to next highest multiple of 4
コンピュータは,次の高位の4の倍数に丸める
参照 truncate(打ち切る;切り捨てる)
decimal (形) 小数の
decimal (名) 小数