Null values
CoddyのSQLジャーニー「基礎」セクションの一部 — レッスン 12/72。
現実世界では、値のないフィールドが存在することがあります。値のないフィールドは null と呼ばれます。
クエリをIS NULLまたはIS NOT NULLを使用して操作することで、関連するデータを取得できます
たとえば、次のクエリは col1 に値がないすべてのレコードを返します:
SELECT *
FROM table1
WHERE col1 IS NULLチャレンジ
簡単利用可能なテーブルと列:
<strong>people</strong>:<strong>name</strong>
欠損値のないすべての一意の名前を取得せよ。
チートシート
IS NULL と IS NOT NULL を使用して、欠損値に基づいてレコードをフィルタリングします:
SELECT *
FROM table1
WHERE col1 IS NULLSELECT *
FROM table1
WHERE col1 IS NOT NULL自分で試してみよう
このレッスンには短いクイズがあります。レッスンを始めて解答し、進捗を記録しましょう。
基礎のすべてのレッスン
4More Keywords
The IN keywordThe BETWEEN keywordThe LIKE keywordThe AS keywordRecap - Cellphone Models2Conditions
Conditions BasicsThe AND keywordThe OR keywordThe NOT keywordMultiple Conditions CombinedParenthesisBooleans5Arithmetic Operations
Mathematical OperatorsMathematical ColumnsThe Modulo OperationThe ROUND() Function3Specific Return Format
Null valuesSort Results Part 1Sort Results Part 2Recap - Cyber Security FirmLimit number of recordsRecap - Vehicle Factory6Intro Challenges
Recap - Parliamentary ElectionRecap - Police Criminal ArrestRecap - Bar Beverage ContainerRecap - Engineer new columns