LoginSignup
11
13

More than 5 years have passed since last update.

MySQLでINNER JOINして検索すると便利だなって話

Posted at

studentsテーブルに
id, nameというアトリビュート(カラム)があったとして

student_scoresテーブルに
id, student_id, math, english, chemistry
アトリビュート(カラム)があったとする

select name, math, english, chemistry from student_scores inner join students on student_scores.student_id=students.id where math = 100 && english = 100 && chemistry =100;

これで、生徒テーブルと点数テーブルをひもづけて
全科目100点の生徒の名前を特定できる

ここを参考にした
http://www.pursue.ne.jp/jouhousyo/SQLDoc/select22.html

11
13
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
13