Report not found

There was a problem finding this report.

Report

Events Table

Inner Join (or Join)

Left Join

Outer Join (with Union)

Outer Join (without Union)

Right Join

Users Table

Blog - Join (Python)
September 5, 2018 · Refreshed 2 months ago

Collaborators

Run History
SELECT * FROM sadavath.events
SELECT * FROM sadavath.events
SELECT t1.name, t2.like FROM sadavath.users t1 FULL OUTER JOIN sadavath.events t2 ON t1.id = t2.user_id
SELECT t1.name, t2.like FROM sadavath.users t1 FULL OUTER JOIN sadavath.events t2 ON t1.id = t2.user_id;
/* INNER JOIN or just JOIN retrieves all users and likes that match each other */ /* ( where the id field in users matches a user_id in the likes table and vice versa ) */ SELECT t1.name, t2.like FROM sadavath.users t1 INNER JOIN sadavath.events t2 ON t1.id = t2.user_id
/* INNER JOIN or just JOIN retrieves all users and likes that match each other */ /* ( where the id field in users matches a user_id in the likes table and vice versa ) */ SELECT t1.name, t2.like FROM sadavath.users t1 INNER JOIN sadavath.events t2 ON t1.id = t2.user_id;
/* OUTER JOIN or OUTER LEFT and RIGHT with UNION (MySQL don't support FULL OUTER JOIN) retrieves all users */ /* and likes and matches them and sets NULL on any like without any match on user and same thing with user */ /* with no matching like */ SELECT t1.name, t2.like FROM sadavath.users t1 LEFT OUTER JOIN sadavath.events t2 ON t1.id = t2.user_id UNION SELECT t1.name, t2.like FROM sadavath.users t1 RIGHT OUTER JOIN sadavath.events t2 ON t1.id = t2.user_id
/* OUTER JOIN or OUTER LEFT and RIGHT with UNION (MySQL don't support FULL OUTER JOIN) retrieves all users */ /* and likes and matches them and sets NULL on any like without any match on user and same thing with user */ /* with no matching like */ SELECT t1.name, t2.like FROM sadavath.users t1 LEFT OUTER JOIN sadavath.events t2 ON t1.id = t2.user_id UNION SELECT t1.name, t2.like FROM sadavath.users t1 RIGHT OUTER JOIN sadavath.events t2 ON t1.id = t2.user_id;
/* RIGHT JOIN is like LEFT JOIN but retrieves all likes with all matching users */ /* or NULL if it don't hav any mathcing user */ SELECT t1.name, t2.like FROM sadavath.users t1 RIGHT JOIN sadavath.events t2 ON t1.id = t2.user_id
/* RIGHT JOIN is like LEFT JOIN but retrieves all likes with all matching users */ /* or NULL if it don't hav any mathcing user */ SELECT t1.name, t2.like FROM sadavath.users t1 RIGHT JOIN sadavath.events t2 ON t1.id = t2.user_id;
/* LEFT JOIN retrieves all users and it's likes if there is any else sets NULL in the like field */ SELECT t1.name, t2.like FROM sadavath.users t1 LEFT JOIN sadavath.events t2 ON t1.id = t2.user_id
/* LEFT JOIN retrieves all users and it's likes if there is any else sets NULL in the like field */ SELECT t1.name, t2.like FROM sadavath.users t1 LEFT JOIN sadavath.events t2 ON t1.id = t2.user_id;
SELECT * FROM sadavath.users
SELECT * FROM sadavath.users;
<div class="mode-header embed-hidden"> <h1>{{ title }}</h1> <p>{{ description }}</p> </div> <div class="mode-grid container"> <div class="row"> <div class="col-md-12"> <mode-python id="python_1b7b96ea0ac1" options="python_options"></mode-python> </div> </div> <div class="row"> <div class="col-md-12"> <mode-python id="python_f8624bb50d7f" options="python_options"></mode-python> </div> </div> <div class="row"> <div class="col-md-12"> <mode-python id="python_993b32f618bc" options="python_options"></mode-python> </div> </div> <div class="row"> <div class="col-md-12"> <mode-python id="python_9797305f7a73" options="python_options"></mode-python> </div> </div> <div class="row"> <div class="col-md-12"> <mode-table id="table_ba64c5b684c1" dataset="dataset" options="table_options"></mode-table> </div> </div> <div class="row"> <div class="col-md-12"> <mode-table id="table_ed79ec32078d" dataset="dataset" options="table_options"></mode-table> </div> </div> <div class="row"> <div class="col-md-12"> <mode-table id="table_d2bf44bb5bad" dataset="dataset" options="table_options"></mode-table> </div> </div> <div class="row"> <div class="col-md-12"> <mode-table id="table_4c180aca71ea" dataset="dataset" options="table_options"></mode-table> </div> </div> </div>
{{ dataSourceName(params.queryId) }}

The dataset is too large to view in browser

Export

Looks like something went wrong with your query.

{{ DS.queryRuns[params.queryId].errorMessage }}
This query was cancelled