Get startedGet started for free

Join the query madness!

Of course, SQL does not stop with the the three keywords SELECT, FROM and WHERE. Another very often used keyword is JOIN, and more specifically INNER JOIN. Take this call for example:

SELECT name, post
  FROM users INNER JOIN tweats on users.id = user_id
    WHERE date > "2015-09-19"

Here, the users table is joined with the tweats table. This is possible because the id column in the users table corresponds to the user_id column in the tweats table. Also notice how name, from the users table, and post and date, from the tweats table, can be referenced to without problems.

Can you predict the outcome of the following query?

SELECT post, message
  FROM tweats INNER JOIN comments on tweats.id = tweat_id
    WHERE tweat_id = 77

A connection to the tweater database is already available as con; feel free to experiment!

This exercise is part of the course

Intermediate Importing Data in R

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise