From programmers.stackexchange.com:
Suppose I'm building a blog that I want to have posts and comments. So I create two tables, a 'posts' table with an autoincrementing integer 'id' column, and a 'comments' table that has a foreign key 'post_id'. Then I want to run what will probably be my most common query, which is to retrieve a post and all of its comments.
Tagged: #sql #databases #exchange #orm #relational