Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ SQL Count, Sum, Avg | SQL Aggregate Functions
SQL Tutorial for Beginners
セクション 2.  3
single

single

bookSQL Count, Sum, Avg

メニューを表示するにはスワイプしてください

Similar to the previous chapter, SUM, AVG, and COUNT functions are aggregate functions that return the sum of field, average value, and count. SUM and AVG can be applied only for numbers, and COUNT - for fields of any data type.

1
SELECT AVG(price) FROM songs
copy

If you want to find the number of records with some condition, you can apply COUNT to the *.

This query outputs the number of records with the release date in the 20th century:

12
SELECT COUNT(*) FROM songs WHERE year <= 2000
copy

Aggregate functions and Distinct

If you want to apply aggregate function to the unique values, write DISTINCT inside this function and before the column name:

1
SELECT COUNT(DISTINCT song) FROM songs
copy
タスク

スワイプしてコーディングを開始

Now you have to write a query that helps you to calculate the total number of singers. Remember that some singers have two or more records in the table, but you have to pick these singers only once.

解答

Switch to desktop実践的な練習のためにデスクトップに切り替える下記のオプションのいずれかを利用して、現在の場所から続行する
すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 2.  3
single

single

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

some-alt