{"id":43596,"date":"2023-08-16T22:40:14","date_gmt":"2023-08-16T20:40:14","guid":{"rendered":"https:\/\/blog.sheetgo.com\/?p=43596"},"modified":"2025-12-17T18:44:03","modified_gmt":"2025-12-17T17:44:03","slug":"syntaxe-bigquery","status":"publish","type":"post","link":"https:\/\/www.sheetgo.com\/fr\/blog\/data-science\/bigquery-syntax\/","title":{"rendered":"Syntaxe de BigQuery"},"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><a href=\"https:\/\/cloud.google.com\/bigquery\" target=\"_blank\" rel=\"noopener\">BigQuery<\/a> is Google\u2019s fully-managed and serverless data warehouse that allows businesses to store and handle large amounts of data without having to invest in infrastructure. In order to retrieve data from BigQuery, they can use SQL syntax to run queries.<\/p>\n<p>In this article, you&#8217;ll find an easy guide to the BigQuery SQL syntax and learn how to write your first SQL queries.<\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;syntax&#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>BigQuery SQL Syntax<\/h2>\n<p>SQL syntax refers to the language rules that you need to follow when writing SQL queries. Whenever you write a statement, you&#8217;ll use keywords such as SELECT, FROM, WHERE, and ORDER BY.<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.21.2&#8243; _module_preset=&#8221;default&#8221; background_color=&#8221;rgba(240,232,255,0.73)&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>Note: In order to improve readability, we&#8217;ll follow some best practices to write SQL queries.<\/p>\n<p>1) We&#8217;ll use uppercase to distinguish between keywords and tables or columns. Therefore, we&#8217;ll capitalize keywords but we&#8217;ll use lowercase for all tables and columns.\u00a0<\/p>\n<p>2) Although we can write multiple statements into the same line, we&#8217;ll separate statements using new lines.\u00a0<\/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>If you want to get started with BigQuery, you&#8217;ll find a quick-start guide to SQL syntax below.<\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;select&#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>SELECT<\/h3>\n<p>We&#8217;ll use the SELECT statement to select the columns the query will return.<\/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><b>SELECT 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>SELECT column1, column2, &#8230;<\/p>\n<p>FROM table_name;<\/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>In this example, we&#8217;ll show you how to use SQL queries to retrieve data from an NCAA basketball dataset.<\/p>\n<p>First, we&#8217;ll execute a SQL query to select three columns &#8211; school_ncaa, name, and alias &#8211; from this dataset.\u00a0<\/p>\n<p>After the SELECT statement, add all the columns you want to select, separated by commas. The FROM clause specifies the table we are querying to retrieve the data.\u00a0<\/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>SELECT school_ncaa, name, alias\u00a0\u00a0\u00a0<\/p>\n<p>FROM `bigquery-public-data.ncaa_basketball.mbb_teams` ;<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/bigquery-syntax-1.png&#8221; alt=&#8221;bigquery syntax 1&#8243; title_text=&#8221;bigquery syntax 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>This query has returned rows with the following columns:<\/p>\n<ul>\n<li>school_ncaa &#8211; This column contains the school name associated with each team.<\/li>\n<li>name &#8211; This column has the team name for each row.<\/li>\n<li>alias &#8211; This column contains common aliases or abbreviated names used for some teams.<\/li>\n<\/ul>\n<p>As you can see, it has returned all the data I&#8217;ve requested split into columns.\u00a0<\/p>\n<p>In this example, I&#8217;ve asked BigQuery to return data from these three columns. If you want to select all columns from the dataset, use an asterisk (*) instead.<\/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>SELECT *\u00a0<\/p>\n<p>FROM `bigquery-public-data.ncaa_basketball.mbb_teams` ;<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/bigquery-syntax-2.png&#8221; alt=&#8221;bigquery syntax 2&#8243; title_text=&#8221;bigquery syntax 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 module_id=&#8221;where&#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>WHERE<\/h3>\n<p>We&#8217;ll use the WHERE clause to filter data from the dataset.<\/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><b>WHERE 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>SELECT column1, column2, &#8230;<\/p>\n<p>FROM table_name<\/p>\n<p>WHERE condition;<\/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>Let&#8217;s say I want to retrieve data from all the columns but only for the rows where the name column equals &#8216;Crimson&#8217;.\u00a0<\/p>\n<p>So let&#8217;s break down the formula:<\/p>\n<p>SELECT * &#8211; This specifies we want all columns returned. The * selects every column.<\/p>\n<p>FROM bigquery-public-data.ncaa_basketball.mbb_teams &#8211; This specifies the table we are querying, the mbb_teams table.<\/p>\n<p>WHERE name = &#8216;Crimson&#8217; &#8211; This WHERE clause filters the rows to only those where the name column value equals &#8216;Crimson&#8217;.<\/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>SELECT *\u00a0\u00a0<\/p>\n<p>FROM `bigquery-public-data.ncaa_basketball.mbb_teams`<\/p>\n<p>WHERE name = &#8216;Crimson&#8217;;<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/bigquery-syntax-3.png&#8221; alt=&#8221;bigquery syntax 3&#8243; title_text=&#8221;bigquery syntax 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>This BigQuery SQL query has returned all columns for rows from the mbb_teams table where the name column equals &#8216;Crimson&#8217;.<\/p>\n<p>Now I&#8217;ll use the OR condition because I want BigQuery to retrieve rows that match either &#8216;Crimson&#8217; or &#8216;Tigers&#8217; team names. I&#8217;ll add an OR condition to the WHERE clause. <\/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>SELECT alias, school_ncaa, name, market<\/p>\n<p>FROM `bigquery-public-data.ncaa_basketball.mbb_teams`<\/p>\n<p>WHERE name = &#8216;Crimson&#8217; OR name = &#8216;Tigers&#8217;;<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/bigquery-syntax-4.png&#8221; alt=&#8221;bigquery syntax 4&#8243; title_text=&#8221;bigquery syntax 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>Now BigQuery has returned data for rows where the name is either &#8216;Crimson&#8217; or &#8216;Tigers&#8217;.<\/p>\n<p>If I want to return multiple values with a WHERE clause, I can add an IN condition to the formula. When I add IN to the WHERE statement, BigQuery will return all the values in brackets.<\/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>SELECT alias, school_ncaa, name, market<\/p>\n<p>FROM `bigquery-public-data.ncaa_basketball.mbb_teams`<\/p>\n<p>WHERE name IN (&#8216;Crimson&#8217;,&#8217;Tigers&#8217;,&#8217;Gators&#8217;);<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/bigquery-syntax-5.png&#8221; alt=&#8221;bigquery syntax 5&#8243; title_text=&#8221;bigquery syntax 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>If you want to add multiple filters or multiple criteria to be met in the query results, you should use the AND condition. The AND condition will return values only when both conditions are satisfied.<\/p>\n<p>In this example, I want BigQuery to return values only for these teams: Auburn Tigers or Clemson Tigers. Therefore, both criteria must be met. The name should be &#8220;Tigers&#8221;, and the school should be Auburn or Clemson. Here&#8217;s the formula I&#8217;ll use:<\/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>SELECT alias, school_ncaa, name, market<\/p>\n<p>FROM `bigquery-public-data.ncaa_basketball.mbb_teams`<\/p>\n<p>WHERE name = &#8216;Tigers&#8217; AND school_ncaa = &#8216;Auburn&#8217; OR school_ncaa = &#8216;Clemson&#8217;;<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/bigquery-syntax-6.png&#8221; alt=&#8221;bigquery syntax 6&#8243; title_text=&#8221;bigquery syntax 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>Now let&#8217;s say I want BigQuery to filter rows where the name starts with &#8216;A&#8217;. Unlike the previous examples, when I used the WHERE statement to return exact values, here I&#8217;ll use the LIKE operator for partial string matching. Here&#8217;s how I can use the LIKE command:<\/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>SELECT alias, school_ncaa, name, market<\/p>\n<p>FROM `bigquery-public-data.ncaa_basketball.mbb_teams`<\/p>\n<p>WHERE name LIKE &#8216;A%&#8217;;<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/bigquery-syntax-7.png&#8221; alt=&#8221;bigquery syntax 7&#8243; title_text=&#8221;bigquery syntax 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 _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>These are some examples of how you can use the LIKE command to filter data based on specific criteria.<\/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<table>\n<tbody>\n<tr>\n<td>\n<p><b>LIKE\u00a0<\/b><\/p>\n<\/td>\n<td>\n<p><b>Result<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>LIKE &#8216;a%&#8217;<\/p>\n<\/td>\n<td>\n<p>Returns values that start with &#8220;a&#8221;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>LIKE &#8216;%a&#8217;<\/p>\n<\/td>\n<td>\n<p>Returns values that end with &#8220;a&#8221;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>LIKE &#8216;%ty%&#8217;<\/p>\n<\/td>\n<td>\n<p>Returns values that have &#8220;ty&#8221; in any position<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>LIKE &#8216;_s%&#8217;<\/p>\n<\/td>\n<td>\n<p>Returns values that have &#8220;s&#8221; in the second position<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>LIKE &#8216;a%s&#8217;<\/p>\n<\/td>\n<td>\n<p>Returns values that start with &#8220;a&#8221; and ends with &#8220;s&#8221;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\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>If I want BigQuery to filter rows where the name starts with &#8216;A&#8217;, but exclude names starting with &#8216;Ag&#8217;, I can add a NOT LIKE command.<\/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>SELECT alias, school_ncaa, name, market<\/p>\n<p>FROM `bigquery-public-data.ncaa_basketball.mbb_teams`<\/p>\n<p>WHERE name LIKE &#8216;A%&#8217; AND name NOT LIKE &#8216;Ag%&#8217;;<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/bigquery-syntax-8.png&#8221; alt=&#8221;bigquery syntax 8&#8243; title_text=&#8221;bigquery syntax 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;order&#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>ORDER BY<\/h3>\n<p>The ORDER BY statement is used to sort values from a specific column in ascending or descending order.<\/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><b>ORDER BY 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>SELECT column1, column2, &#8230;<\/p>\n<p>FROM table_name<\/p>\n<p>ORDER BY column1, column2, &#8230; ASC|DESC;<\/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>I&#8217;ll write a query to retrieve data filtered by a specific team name and order the results by school in ascending order. When I order results in ascending order, the ASC condition is optional.<\/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>SELECT alias, school_ncaa, name, market<\/p>\n<p>FROM `bigquery-public-data.ncaa_basketball.mbb_teams`<\/p>\n<p>WHERE name = &#8216;Tigers&#8217;<\/p>\n<p>ORDER BY school_ncaa;<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/bigquery-syntax-9.png&#8221; alt=&#8221;bigquery syntax 9&#8243; title_text=&#8221;bigquery syntax 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 _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>As you can see, BigQuery has sorted the school names alphabetically. If I add the DESC condition, it will sort the school names in descending order.<\/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>SELECT alias, school_ncaa, name, market<\/p>\n<p>FROM `bigquery-public-data.ncaa_basketball.mbb_teams`<\/p>\n<p>WHERE name = &#8216;Tigers&#8217;<\/p>\n<p>ORDER BY school_ncaa DESC;<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2023\/08\/bigquery-syntax-10.png&#8221; alt=&#8221;bigquery syntax 10&#8243; title_text=&#8221;bigquery syntax 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 module_id=&#8221;connect&#8221; _builder_version=&#8221;4.27.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2>How to connect BigQuery to Google Sheets<\/h2>\n<p>There you have it! That&#8217;s how you can write your first queries using SQL in BigQuery. If you&#8217;re a spreadsheet user, check out this article on <a href=\"https:\/\/www.sheetgo.com\/blog\/how-to-solve-with-sheetgo\/how-to-get-data-from-bigquery-to-google-sheets-automatically\/\">getting data from BigQuery to Google Sheets automatically.<\/a><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>BigQuery is Google\u2019s fully-managed and serverless data warehouse that allows businesses to store and handle large amounts of data without having to invest in infrastructure. In order to retrieve data from BigQuery, they can use SQL syntax to run queries. In this article, you&#8217;ll find an easy guide to the BigQuery SQL syntax and learn [&hellip;]<\/p>\n","protected":false},"author":42,"featured_media":43843,"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-43596","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-science"],"acf":[],"permalink_manager":null,"_links":{"self":[{"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/posts\/43596","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/comments?post=43596"}],"version-history":[{"count":0,"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/posts\/43596\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/media\/43843"}],"wp:attachment":[{"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/media?parent=43596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/categories?post=43596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/tags?post=43596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}