JOIN

An join statement is used to combine data from different tables. A join is implemented by a statement like follows:

SELECT * FROM post
INNER JOIN location
ON (post.country=location.country AND post.city=location.city)
WHERE (post.city='Richmond' AND post.country='Canada').

In our project:

  • We implemented a join statement in displaying the posts from certain locations. An example statement is the statement seen above, where we joined the location and post tables on the city and country. Using this, we were able to display posts from locations.
  • You can see this in action by going to All locations and clicking on any location. If there are posts associated with it, it will be shown.