Joined January 2013
·

Pap Tamas

CEO and Full Stack Developer at script57 at script57
·
Cluj-Napoca, Romania
·
·

About SQL JOINS

I think sql JOINs can not be always avoided.

Let's take a very basic, well known example: storing authors and blog posts in a db.
If we create two tables:

authors <br/>
* authorid<br/>
* full
name<br/>

and

posts<br/>
* postid<br/>
* author
id<br/>
* title<br/>
* text<br/>

When we want to show the list of posts and their authors we can do a JOIN like this:

SELECT authors.author_id, authors.full_name, posts.title, posts.text FROM posts JOIN authors ON authors.author_id = posts.author_id

How should we avoid the JOIN in this simple scenario?

Can you give some concrete examples with avoiding JOINS, and how to avoid them?

Cheers

Achievements
36 Karma
0 Followers
4,894 Total ProTip Views