Skip to content

Commit 1d7d593

Browse files
committed
add SQLBolt lessons up until 10
1 parent eaea1c6 commit 1d7d593

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

sql_guides/sql.ipynb

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@
5656
"metadata": {},
5757
"source": [
5858
"\n",
59-
"This is an SQL statement, made up of clauses that read or mutate a database\n",
59+
"This is an SQL statement, made up of clauses that read or mutate a database. The following examples are pulled from SQLBolt.\n",
6060
"\n",
6161
"`SELECT` _what column(s)_ `FROM` _what table(s)_<br>\n",
6262
"`WHERE` _filter condition_ `AND` _another condition_ `OR` _another condition_<br>\n",
6363
"`JOIN` _connect data from different tables_<br>\n",
6464
"The first line includes the SQL Identifiers: `SELECT` & `FROM`\n",
6565
"\n",
66-
"#### Basic Examples\n",
66+
"#### Basic Examples (One Table)\n",
6767
"`SELECT` * `FROM` movies<br>\n",
6868
"`SELECT` title `FROM` movies<br>\n",
6969
"`SELECT` title, director `FROM` movies<br>\n",
@@ -78,9 +78,25 @@
7878
"`SELECT` `DISTINCT` director `FROM` movies `ORDER BY` director `ASC`<br>\n",
7979
"`SELECT` * `FROM` movies `ORDER BY` year `DESC` `LIMIT` 4<br>\n",
8080
"`SELECT` * `FROM` movies `ORDER BY` title `ASC` `LIMIT` 5 `OFFSET` 5<br>\n",
81+
"`SELECT` * `FROM` movies `WHERE` title `IS NULL`<br>\n",
82+
"`SELECT` * `FROM` movies `WHERE` title `IS NOT NULL`\n",
8183
"\n",
82-
"#### More Examples\n",
83-
"TBD (from lesson 5)<br>"
84+
"#### More Examples (Multiple Tables)\n",
85+
"`SELECT` * `FROM` movies `INNER JOIN` boxoffice `ON` id=movie_id<br>\n",
86+
"`SELECT` * `FROM` movies `INNER JOIN` boxoffice `ON` id=movie_id `WHERE` international_sales>domestic_sales<br>\n",
87+
"`SELECT` * `FROM` movies `INNER JOIN` boxoffice `ON` id=movie_id `ORDER BY` rating `DESC`\n",
88+
"\n",
89+
"#### Multiple Tables, But With Asymmetric Data\n",
90+
"`SELECT` `DISTINCT` building_name, role `FROM` buildings `LEFT JOIN` employees `ON` building_name=building<br>\n",
91+
"`SELECT` * `FROM` buildings `LEFT JOIN` employees `ON` building_name=building `WHERE` role `IS NULL`\n",
92+
"\n",
93+
"#### Queries & Expressions\n",
94+
"`SELECT` title, (domestic_sales+international_sales)/1000000 `AS` gross_sales_millions\n",
95+
"`FROM` movies `JOIN` boxoffice `ON` movies.id=boxoffice.movie_id<br>\n",
96+
"`SELECT` title, rating*10 `AS` rating_percent `FROM` movies `JOIN` boxoffice `ON` movies.id =boxoffice.movie_id<br>\n",
97+
"`SELECT` title, year `FROM` movies `WHERE` year%2=0\n",
98+
"\n",
99+
"#### PICK UP FROM LESSON 10 ..."
84100
]
85101
},
86102
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy