ソースコード
UPDATE scores AS s
SET passed  = TRUE
FROM (SELECT subject_code, AVG(score) AS avg FROM scores GROUP BY subject_code) AS sub
WHERE s.subject_code = sub.subject_code AND s.score >= sub.avg;

UPDATE scores AS s
SET passed  = FALSE
FROM (SELECT subject_code, AVG(score) AS avg FROM scores GROUP BY subject_code) AS sub
WHERE s.subject_code = sub.subject_code AND s.score < sub.avg;

SELECT * FROM scores;
提出情報
提出日時2024/07/08 11:36:21
コンテストSQLの教科書確認用コンテスト4
問題副問合せの結果で絞り込み2
受験者ogata24026
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量89 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
86 MB
データパターン2
AC
89 MB
データパターン3
AC
89 MB