Search code examples
mysqlsqldatabase-normalization

MYSQL : Inner Join On Three tables


Tables

needed output

Please Help Me .


Solution

  • Try this:-

    Select a.roll_no, name, sport_name
    from
    student a
    inner join
    student_details b
    on a.roll_no=b.roll_no
    inner join
    sports c
    on b.sport_id=c.sport_id
    where a.roll_no in (1,3);
    

    'Where' condition here helps restrict out to just Sandeep and Ajay. If you want for all then remove 'Where' condition completely