{"id":43680,"date":"2023-08-21T14:43:10","date_gmt":"2023-08-21T12:43:10","guid":{"rendered":"https:\/\/blog.sheetgo.com\/?p=43680"},"modified":"2025-12-17T18:44:06","modified_gmt":"2025-12-17T17:44:06","slug":"bigquery-junta-um-guia-passo-a-passo","status":"publish","type":"post","link":"https:\/\/www.sheetgo.com\/pt\/blog\/data-science\/bigquery-joins-a-step-by-step-guide\/","title":{"rendered":"Uni\u00f5es do BigQuery: um guia passo a passo"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221; da_is_popup=&#8221;off&#8221; da_exit_intent=&#8221;off&#8221; da_has_close=&#8221;on&#8221; da_alt_close=&#8221;off&#8221; da_dark_close=&#8221;off&#8221; da_not_modal=&#8221;on&#8221; da_is_singular=&#8221;off&#8221; da_with_loader=&#8221;off&#8221; da_has_shadow=&#8221;on&#8221; da_disable_devices=&#8221;off|off|off&#8221;][et_pb_row _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">When you use BigQuery joins, you can combine data from multiple tables. By joining tables together, you can query data based on relationships and correlations across datasets.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">However, it&#8217;s important to mention that there are a few types of joins in BigQuery SQL: INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN. Each join type enables you to match rows between tables differently.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In this article, you&#8217;ll find a step-by-step tutorial on how to use BigQuery joins to combine data from multiple tables.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Note: If you don&#8217;t know how to write basic SQL queries yet, check out this tutorial on how to use <\/span><a href=\"https:\/\/www.sheetgo.com\/blog\/integrations\/bigquery-syntax\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">BigQuery SQL syntax<\/span><\/a><span style=\"font-weight: 400;\"> before reading this article.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;guide&#8221; _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2><span style=\"font-weight: 400;\">A guide to SQL Joins in BigQuery<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Before we start writing queries using BigQuery joins, we need to understand how these four types of joins work and how you can use them to merge data in BigQuery.<\/span><\/p>\n<p><b>INNER JOIN<\/b><span style=\"font-weight: 400;\">: the inner join matches rows between two tables and returns only the matching rows. Therefore, when you combine data, it will leave out all the unmatched rows.<\/span><\/p>\n<p><b>LEFT JOIN<\/b><span style=\"font-weight: 400;\">: a left join matches all rows from the left table even if no matching row exists in the right table. Here, BigQuery will return all the rows from the left table and the matched rows from the right table.<\/span><\/p>\n<p><b>RIGHT JOIN<\/b><span style=\"font-weight: 400;\">: it is the opposite of a left join. It matches all rows from the right table even if no matching row exists in the left table.<\/span><\/p>\n<p><b>FULL JOIN<\/b><span style=\"font-weight: 400;\">: a full join combines left and right joins. All rows from both tables are returned regardless of whether they match.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;types&#8221; _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2><span style=\"font-weight: 400;\">Join types explained<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Here&#8217;s a visual representation of these four join types.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/BigQuery-Joins-1.png&#8221; alt=&#8221;BigQuery Joins 1&#8243; title_text=&#8221;BigQuery Joins 1&#8243; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">As you can see, the inner join will return only the matching rows, a left join will return all the rows from the left table, a right join will return all the rows from the right table, and a full join will return all the rows from both tables.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here&#8217;s an example:<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/BigQuery-Joins-2.png&#8221; alt=&#8221;BigQuery Joins 2&#8243; title_text=&#8221;BigQuery Joins 2&#8243; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">Let&#8217;s say I have these two tables containing information about NCAA basketball teams. While these tables share the &#8220;Name&#8221; column, they also contain some different items. I&#8217;ll combine the data from these two tables, joining the shared &#8220;Name&#8221; column.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">By using INNER JOIN, BigQuery would return only the matching rows. Here&#8217;s what the result would look like.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/BigQuery-Joins-3.png&#8221; alt=&#8221;BigQuery Joins 3&#8243; title_text=&#8221;BigQuery Joins 3&#8243; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">As you can see, BigQuery returned the matching rows but left out all the unmatched rows.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If I use LEFT join, BigQuery will return all the rows from the left table. As a result, it will leave out all the unmatched rows from the right table.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/BigQuery-Joins-4.png&#8221; alt=&#8221;BigQuery Joins 4&#8243; title_text=&#8221;BigQuery Joins 4&#8243; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">By using RIGHT JOIN, BigQuery will return all the rows from the right table instead, leaving out the unmatched rows from the left table.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/BigQuery-Joins-5.png&#8221; alt=&#8221;BigQuery Joins 5&#8243; title_text=&#8221;BigQuery Joins 5&#8243; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">Lastly, FULL JOIN will return all rows from both tables, including unmatched rows on either side.\u00a0<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/BigQuery-Joins-6.png&#8221; alt=&#8221;BigQuery Joins 6&#8243; title_text=&#8221;BigQuery Joins 6&#8243; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">In all these cases, BigQuery would return the word &#8220;null&#8221; to fill in for all the missing matches.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Now that you know the differences between these types of join, we&#8217;ll learn how to combine data using these BigQuery joins.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;inner&#8221; _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3><span style=\"font-weight: 400;\">INNER JOIN<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">First, I&#8217;ll use the INNER JOIN keyword because I want BigQuery to return only matching rows from two tables. Here&#8217;s the syntax I&#8217;ll use:<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><b>INNER JOIN Syntax<\/b><\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.21.2&#8243; border_width_left=&#8221;4px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">SELECT column_name(s)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">FROM table1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">INNER JOIN table2<\/span><\/p>\n<p><span style=\"font-weight: 400;\">ON table1.column_name = table2.column_name;<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">I\u2019ll show you how to use BigQuery joins to combine data from these NCAA basketball datasets. While one of the tables contains information about NCAA teams (mbb_teams), the other table contains data about these teams&#8217; mascots. <\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.21.2&#8243; border_width_left=&#8221;4px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">SELECT *\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">FROM `bigquery-public-data.ncaa_basketball.mascots` AS mascots<\/span><\/p>\n<p><span style=\"font-weight: 400;\">INNER JOIN `bigquery-public-data.ncaa_basketball.mbb_teams` AS teams<\/span><\/p>\n<p><span style=\"font-weight: 400;\">ON mascots.name = teams.name;<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">Let&#8217;s break it down:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">1) First, I want to select all columns from the results. I&#8217;ll use the SELECT * clause.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">2) The FROM clause specifies the first table in the join. I&#8217;ve used an alias (AS) to give this table a temporary name (&#8220;mascots&#8221;).This enables me to use the alias later rather than write the full table name.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">3) The INNER JOIN clause specifies the second table. I&#8217;ve also used an alias to name this table.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">4) The ON statement is the condition matching the columns between the two tables. Instead of writing the table name, I used the aliases followed by the column: &#8220;name&#8221;.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/BigQuery-Joins-7.png&#8221; alt=&#8221;BigQuery Joins 7&#8243; title_text=&#8221;BigQuery Joins 7&#8243; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text module_id=&#8221;left&#8221; _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3><span style=\"font-weight: 400;\">LEFT JOIN<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">After learning how to use the INNER JOIN statement, you can easily write a LEFT JOIN query by following the same pattern.<\/span><\/p>\n<p><b>LEFT JOIN Syntax<\/b><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.21.2&#8243; border_width_left=&#8221;4px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">SELECT column_name(s)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">FROM table1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">LEFT JOIN table2<\/span><\/p>\n<p><span style=\"font-weight: 400;\">ON table1.column_name = table2.column_name;<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">Here&#8217;s the complete formula.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.21.2&#8243; border_width_left=&#8221;4px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">SELECT *\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">FROM `bigquery-public-data.ncaa_basketball.mascots` AS mascots<\/span><\/p>\n<p><span style=\"font-weight: 400;\">LEFT JOIN `bigquery-public-data.ncaa_basketball.mbb_teams` AS teams<\/span><\/p>\n<p><span style=\"font-weight: 400;\">ON mascots.name = teams.name;<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/BigQuery-Joins-8.png&#8221; alt=&#8221;BigQuery Joins 8&#8243; title_text=&#8221;BigQuery Joins 8&#8243; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text module_id=&#8221;right&#8221; _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3><span style=\"font-weight: 400;\">RIGHT JOIN<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Now let&#8217;s write a SQL query to return only the matching rows from the right table.<\/span><\/p>\n<p><b>RIGHT JOIN Syntax<\/b><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.21.2&#8243; border_width_left=&#8221;4px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">SELECT column_name(s)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">FROM table1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">RIGHT JOIN table2<\/span><\/p>\n<p><span style=\"font-weight: 400;\">ON table1.column_name = table2.column_name;<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">Here&#8217;s what the query would look like.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.21.2&#8243; border_width_left=&#8221;4px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">SELECT *\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">FROM `bigquery-public-data.ncaa_basketball.mascots` AS mascots<\/span><\/p>\n<p><span style=\"font-weight: 400;\">RIGHT JOIN `bigquery-public-data.ncaa_basketball.mbb_teams` AS teams<\/span><\/p>\n<p><span style=\"font-weight: 400;\">ON mascots.name = teams.name;<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/BigQuery-Joins-9.png&#8221; alt=&#8221;BigQuery Joins 9&#8243; title_text=&#8221;BigQuery Joins 9&#8243; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text module_id=&#8221;full&#8221; _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3><span style=\"font-weight: 400;\">FULL JOIN<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Lastly, we can use FULL JOIN to write a query to return all rows from both tables, regardless of whether they match. Here&#8217;s the FULL JOIN syntax.<\/span><\/p>\n<p><b>FULL JOIN Syntax<\/b><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.21.2&#8243; border_width_left=&#8221;4px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">SELECT column_name(s)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">FROM table1<\/span><\/p>\n<p><span style=\"font-weight: 400;\">FULL JOIN table2<\/span><\/p>\n<p><span style=\"font-weight: 400;\">ON table1.column_name = table2.column_name;<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">That&#8217;s what the full query would look like.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.21.2&#8243; border_width_left=&#8221;4px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">SELECT *\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">FROM `bigquery-public-data.ncaa_basketball.mascots` AS mascots<\/span><\/p>\n<p><span style=\"font-weight: 400;\">FULL JOIN `bigquery-public-data.ncaa_basketball.mbb_teams` AS teams<\/span><\/p>\n<p><span style=\"font-weight: 400;\">ON mascots.name = teams.name;<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/BigQuery-Joins-10.png&#8221; alt=&#8221;BigQuery Joins 10&#8243; title_text=&#8221;BigQuery Joins 10&#8243; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">Keep in mind that you can combine JOIN clauses with other statements. For example, I could combine these two tables, and use WHERE to filter specific data. Let&#8217;s say I want BigQuery to return only mascots starting with the letter &#8220;A&#8221;.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.21.2&#8243; border_width_left=&#8221;4px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">SELECT *\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">FROM `bigquery-public-data.ncaa_basketball.mascots` AS mascots<\/span><\/p>\n<p><span style=\"font-weight: 400;\">FULL JOIN `bigquery-public-data.ncaa_basketball.mbb_teams` AS teams<\/span><\/p>\n<p><span style=\"font-weight: 400;\">ON mascots.name = teams.name<\/span><\/p>\n<p><span style=\"font-weight: 400;\">WHERE mascot LIKE &#8216;A%&#8217;;<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/BigQuery-Joins-11.png&#8221; title_text=&#8221;BigQuery Joins 11&#8243; align=&#8221;center&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; width=&#8221;100%&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h1><span style=\"font-weight: 400;\">BigQuery joins: a step-by-step guide<\/span><\/h1>\n<p><span style=\"font-weight: 400;\">There you have it! That&#8217;s how you can use BigQuery joins to combine data from multiple tables. If you want to learn more about BigQuery, check out this article on how to use <\/span><a href=\"https:\/\/www.sheetgo.com\/blog\/integrations\/bigquery-syntax\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">BigQuery SQL syntax<\/span><\/a><span style=\"font-weight: 400;\"> to write your first queries.<\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you use BigQuery joins, you can combine data from multiple tables. By joining tables together, you can query data based on relationships and correlations across datasets. However, it&#8217;s important to mention that there are a few types of joins in BigQuery SQL: INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN. Each join type [&hellip;]<\/p>\n","protected":false},"author":42,"featured_media":43846,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[31],"tags":[],"class_list":["post-43680","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-science"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts\/43680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/comments?post=43680"}],"version-history":[{"count":0,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts\/43680\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/media\/43846"}],"wp:attachment":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/media?parent=43680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/categories?post=43680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/tags?post=43680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}