Difference between these two joining table approaches?

后端 未结 4 1518
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-30 12:28

Consider we have two tables, Users and Posts. user_id is the foreign key in Posts table and is primary key in Users

4条回答
  •  被撕碎了的回忆
    2020-11-30 13:07

    where post.user_id = user.user_id
    

    Here you are making a conditional statement

    from users as user join posts as post using user_id
    

    Here you are joining two tables using the foreign key

    At the end is just the same but JOIN is better used for more advanced queries...

提交回复
热议问题