Recap - Bar Beverage Container
CoddyのSQLジャーニー「基礎」セクションの一部 — レッスン 29/72。
チャレンジ
簡単利用可能なテーブルと列:
<strong>beverages</strong>:<strong>id</strong>,<strong>current_year</strong>,<strong>expiration_year</strong>
あなたのバーには豊富なジュースの品揃えがあり、注意が必要なものを特定する必要があります。以下の明確な基準に基づいて、これらのジュースを特定し、並べ替えてください。
Old Expired Juices- 現在年から6年以上前に期限が切れたジュース(
current_year - expiration_year > 6) - これらは直ちにリサイクルする必要があります
- 現在年から6年以上前に期限が切れたジュース(
Almost Expired Juices- 現在年に期限切れとなるジュース
- または、次の年に期限切れとなるジュース(
expiration_year = current_year + 1) - これらは更新のために送付する必要があります
以下の手順に従ってください:
- これらの基準のいずれかを満たすジュースの ID を抽出します
- ID 列を 'to_renew' にリネームします
- 処理優先度で結果をソートします:
- 最も緊急度の高いものから(最も古い期限切れジュース)
- 次に、ほぼ期限切れのジュース
- ソートには (current_year - expiration_year) を使用します
自分で試してみよう
基礎のすべてのレッスン
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