Kodewick
学びはじめる →
基礎←→0 / 70

短い名前

#041基礎JOIN + AS約 4 分

通知表にはすべての点数が並びます。students と scores を(scores.student_id = students.id で)つなぎ、name、subject、score をこの順で選んでください。長いテーブル名を書くのが面倒なら、テーブルに短い名前をつけましょう。

使うテーブル
students
  • idPK
  • name
  • class
  • age
  • city
scores
  • idPK
  • student_idFK
  • subject
  • score

scores.student_id → students.id

students
idnameclassagecity
1Amy1A12Leeds
2Ben1A13York
3Cara1B12NULL
4Dan1B14Leeds
5Eva1A12Hull
6Finn1C13NULL
7Gus1C12York
7 行
scores
idstudent_idsubjectscore
11math92
21art78
32math65
42art88
53math74
64math55
74art90
85math81
95artNULL
107math99
10 行
query.sql
-- ここにコードを書く:AS で 2 つのテーブルに短い名前をつけてつなぎ、name、subject、score を選ぶ
SELECT name
FROM students;
Ctrl + Enter でも実行できます
結果

実行するとクエリの結果が表示されます。よさそうなら提出しましょう。