Browse Source

finish sql

master
Chris Yealy 10 months ago
parent
commit
cd3bfd36d6
1 changed files with 76 additions and 589 deletions
  1. +76
    -589
      02-sql/SQL Wizard.ipynb

+ 76
- 589
02-sql/SQL Wizard.ipynb View File

@ -16,10 +16,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "ae40bab8", "id": "ae40bab8",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[32mDeploy AI and data apps for free on Ploomber Cloud! Learn more: https://docs.cloud.ploomber.io/en/latest/quickstart/signup.html\u001b[0m\n"
]
},
{ {
"data": { "data": {
"text/html": [ "text/html": [
@ -75,7 +82,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"id": "45e2c86e", "id": "45e2c86e",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -124,304 +131,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "cf28b6f1-c215-405c-afbf-c65cac1c2b7c", "id": "cf28b6f1-c215-405c-afbf-c65cac1c2b7c",
"metadata": { "metadata": {
"scrolled": true "scrolled": true
}, },
"outputs": [
{
"data": {
"text/html": [
"<span style=\"None\">Running query in &#x27;sqlite:///properties.db&#x27;</span>"
],
"text/plain": [
"Running query in 'sqlite:///properties.db'"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<table>\n",
" <thead>\n",
" <tr>\n",
" <th>id</th>\n",
" <th>name</th>\n",
" <th>latitude</th>\n",
" <th>longitude</th>\n",
" <th>prioritize_listing</th>\n",
" <th>min_rental_age</th>\n",
" <th>promote</th>\n",
" <th>property_search_priority</th>\n",
" <th>access_types</th>\n",
" <th>featured_amenities</th>\n",
" <th>home_type</th>\n",
" <th>neighborhood</th>\n",
" <th>all_amenities</th>\n",
" <th>url</th>\n",
" <th>reviews_count</th>\n",
" <th>reviews_rating</th>\n",
" <th>baths</th>\n",
" <th>beds</th>\n",
" <th>total_occupants</th>\n",
" <th>shared_baths</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>e2el5x-rci-571</td>\n",
" <td>Abbot's Bliss</td>\n",
" <td>39.514008</td>\n",
" <td>-79.289635</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Lake Front\"]</td>\n",
" <td>[\"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Game Table\", \"Grill\", \"Home Office\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Carmel Cove\"]</td>\n",
" <td>[\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"Dog Friendly\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Wood)\", \"Game Table\", \"Grill\", \"Grill (Charcoal)\", \"Grill (Gas)\", \"Home Office\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\", \"Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/abbots-bliss>https://www.deepcreek.com/vacation-rentals/abbots-bliss</a></td>\n",
" <td>32</td>\n",
" <td>4.3438</td>\n",
" <td>4</td>\n",
" <td>6</td>\n",
" <td>16</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-572</td>\n",
" <td>Absolute Delight</td>\n",
" <td>39.50175</td>\n",
" <td>-79.32296</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Lake Front\"]</td>\n",
" <td>[\"A/C\", \"Dock\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Glendale Rd.\"]</td>\n",
" <td>[\"A/C (Central)\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Gas)\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Charcoal)\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\", \"Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/absolute-delight>https://www.deepcreek.com/vacation-rentals/absolute-delight</a></td>\n",
" <td>40</td>\n",
" <td>4.65</td>\n",
" <td>6</td>\n",
" <td>8</td>\n",
" <td>25</td>\n",
" <td>[\"1\"]</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-573</td>\n",
" <td>Ace's Chalet</td>\n",
" <td>39.545776</td>\n",
" <td>-79.37889</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Limited Lake Access\", \"Ski In/Ski Out\"]</td>\n",
" <td>[\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"North Camp\"]</td>\n",
" <td>[\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"Dog Friendly\", \"A/C\", \"All Bedrooms Are Suites\", \"Fireplace\", \"Fireplace (Wood)\", \"Game Table\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"WIFI\", \"No Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/aces-chalet>https://www.deepcreek.com/vacation-rentals/aces-chalet</a></td>\n",
" <td>48</td>\n",
" <td>4.3333</td>\n",
" <td>6</td>\n",
" <td>5</td>\n",
" <td>16</td>\n",
" <td>[\"1\"]</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-574</td>\n",
" <td>Adventure Bound</td>\n",
" <td>39.53931</td>\n",
" <td>-79.35391</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Lake Front\", \"Ski Area\"]</td>\n",
" <td>[\"Provides Firewood (Valid: 9/15 - 4/15)\", \"Dock\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Marsh Hill Rd.\"]</td>\n",
" <td>[\"Provides Firewood (Valid: 9/15 - 4/15)\", \"Dog Friendly\", \"Dock\", \"Dock (Private)\", \"Fireplace\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Charcoal)\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\", \"Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/adventure-bound>https://www.deepcreek.com/vacation-rentals/adventure-bound</a></td>\n",
" <td>46</td>\n",
" <td>3.913</td>\n",
" <td>3</td>\n",
" <td>5</td>\n",
" <td>14</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-581</td>\n",
" <td>Altitude Adjustment</td>\n",
" <td>39.53566</td>\n",
" <td>-79.37087</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Golf Area\", \"Lake Area\"]</td>\n",
" <td>[\"Signature Collection Home\", \"CARC\", \"A/C\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"WIFI\", \"EV Charging\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Biltmore at Lodestone\"]</td>\n",
" <td>[\"A/C (Central)\", \"Signature Collection Home\", \"CARC Indoor Pool & Fitness Membership\", \"Dog Friendly\", \"A/C\", \"All Bedrooms Are Suites\", \"Fireplace\", \"Fireplace (Gas)\", \"Game Table\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"WIFI\", \"No Bunk Beds\", \"Electric Vehicle Charging Station\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/altitude-adjustment>https://www.deepcreek.com/vacation-rentals/altitude-adjustment</a></td>\n",
" <td>82</td>\n",
" <td>4.8415</td>\n",
" <td>5</td>\n",
" <td>5</td>\n",
" <td>14</td>\n",
" <td>[\"1\"]</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-585</td>\n",
" <td>American Eagle Lodge</td>\n",
" <td>39.55831</td>\n",
" <td>-79.35635</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Lake Front\", \"Ski Area\"]</td>\n",
" <td>[\"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"Swimming Pool\", \"WIFI\", \"Sauna\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Deep Creek Drive\"]</td>\n",
" <td>[\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Gas)\", \"Fireplace (Wood)\", \"Game Table\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"Swimming Pool\", \"Swimming Pool (Private)\", \"WIFI\", \"Sauna\", \"No Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/american-eagle-lodge>https://www.deepcreek.com/vacation-rentals/american-eagle-lodge</a></td>\n",
" <td>41</td>\n",
" <td>4.4146</td>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" <td>26</td>\n",
" <td>[\"2\"]</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-589</td>\n",
" <td>Almost Aspen</td>\n",
" <td>39.501404</td>\n",
" <td>-79.32321</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Lake Front\"]</td>\n",
" <td>[\"Signature Collection Home\", \"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Glendale Rd.\"]</td>\n",
" <td>[\"A/C (Central)\", \"Signature Collection Home\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Gas)\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\", \"Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/almost-aspen>https://www.deepcreek.com/vacation-rentals/almost-aspen</a></td>\n",
" <td>55</td>\n",
" <td>4.6909</td>\n",
" <td>6</td>\n",
" <td>7</td>\n",
" <td>20</td>\n",
" <td>[\"1\"]</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-592</td>\n",
" <td>At Lake's Edge</td>\n",
" <td>39.50574</td>\n",
" <td>-79.277855</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Golf Area\", \"Lake Front\"]</td>\n",
" <td>[\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"Weddings Considered (Fees Apply)\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Waterfront Greens\"]</td>\n",
" <td>[\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"Weddings Considered (Fees Apply)\", \"WIFI\", \"No Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/lakes-edge>https://www.deepcreek.com/vacation-rentals/lakes-edge</a></td>\n",
" <td>37</td>\n",
" <td>4.3784</td>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" <td>20</td>\n",
" <td>[\"1\"]</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-594</td>\n",
" <td>Awesome View</td>\n",
" <td>39.501785</td>\n",
" <td>-79.32087</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Lake Front\"]</td>\n",
" <td>[\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Swimming Pool\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Glendale Rd.\"]</td>\n",
" <td>[\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"A/C\", \"Dock\", \"Dock (Private)\", \"Fireplace\", \"Fireplace (Gas)\", \"Fireplace (Wood)\", \"Game Table\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Swimming Pool\", \"Swimming Pool (Private)\", \"WIFI\", \"No Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/awesome-view>https://www.deepcreek.com/vacation-rentals/awesome-view</a></td>\n",
" <td>33</td>\n",
" <td>4.0606</td>\n",
" <td>6</td>\n",
" <td>8</td>\n",
" <td>24</td>\n",
" <td>[\"1\"]</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-606</td>\n",
" <td>Beyond Bliss</td>\n",
" <td>39.50577</td>\n",
" <td>-79.27956</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Golf Area\", \"Lake Front\"]</td>\n",
" <td>[\"Signature Collection Home\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Grill\", \"Home Theater\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Swimming Pool\", \"Weddings Considered (Fees Apply)\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Waterfront Greens\"]</td>\n",
" <td>[\"A/C (Central)\", \"Signature Collection Home\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"All Bedrooms Are Suites\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Gas)\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Gas)\", \"Home Theater\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Swimming Pool\", \"Swimming Pool (Private)\", \"Weddings Considered (Fees Apply)\", \"WIFI\", \"No Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/beyond-bliss>https://www.deepcreek.com/vacation-rentals/beyond-bliss</a></td>\n",
" <td>37</td>\n",
" <td>4.2703</td>\n",
" <td>9</td>\n",
" <td>8</td>\n",
" <td>20</td>\n",
" <td>[\"1\"]</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<span style=\"font-style:italic;text-align:center;\">Truncated to <a href=\"https://jupysql.ploomber.io/en/latest/api/configuration.html#displaylimit\">displaylimit</a> of 10.</span>"
],
"text/plain": [
"+----------------+----------------------+-----------+------------+--------------------+----------------+---------+--------------------------+-------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+---------------+----------------+-------+------+-----------------+--------------+\n",
"| id | name | latitude | longitude | prioritize_listing | min_rental_age | promote | property_search_priority | access_types | featured_amenities | home_type | neighborhood | all_amenities | url | reviews_count | reviews_rating | baths | beds | total_occupants | shared_baths |\n",
"+----------------+----------------------+-----------+------------+--------------------+----------------+---------+--------------------------+-------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+---------------+----------------+-------+------+-----------------+--------------+\n",
"| e2el5x-rci-571 | Abbot's Bliss | 39.514008 | -79.289635 | 0 | 24 | 0 | 0 | [\"Lake Front\"] | [\"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Game Table\", \"Grill\", \"Home Office\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\"] | [\"House\"] | [\"Carmel Cove\"] | [\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"Dog Friendly\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Wood)\", \"Game Table\", \"Grill\", \"Grill (Charcoal)\", \"Grill (Gas)\", \"Home Office\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\", \"Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/abbots-bliss>https://www.deepcreek.com/vacation-rentals/abbots-bliss</a> | 32 | 4.3438 | 4 | 6 | 16 | None |\n",
"| e2el5x-rci-572 | Absolute Delight | 39.50175 | -79.32296 | 0 | 24 | 0 | 0 | [\"Lake Front\"] | [\"A/C\", \"Dock\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\"] | [\"House\"] | [\"Glendale Rd.\"] | [\"A/C (Central)\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Gas)\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Charcoal)\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\", \"Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/absolute-delight>https://www.deepcreek.com/vacation-rentals/absolute-delight</a> | 40 | 4.65 | 6 | 8 | 25 | [\"1\"] |\n",
"| e2el5x-rci-573 | Ace's Chalet | 39.545776 | -79.37889 | 0 | 24 | 0 | 0 | [\"Limited Lake Access\", \"Ski In/Ski Out\"] | [\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"WIFI\"] | [\"House\"] | [\"North Camp\"] | [\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"Dog Friendly\", \"A/C\", \"All Bedrooms Are Suites\", \"Fireplace\", \"Fireplace (Wood)\", \"Game Table\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"WIFI\", \"No Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/aces-chalet>https://www.deepcreek.com/vacation-rentals/aces-chalet</a> | 48 | 4.3333 | 6 | 5 | 16 | [\"1\"] |\n",
"| e2el5x-rci-574 | Adventure Bound | 39.53931 | -79.35391 | 0 | 24 | 0 | 0 | [\"Lake Front\", \"Ski Area\"] | [\"Provides Firewood (Valid: 9/15 - 4/15)\", \"Dock\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\"] | [\"House\"] | [\"Marsh Hill Rd.\"] | [\"Provides Firewood (Valid: 9/15 - 4/15)\", \"Dog Friendly\", \"Dock\", \"Dock (Private)\", \"Fireplace\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Charcoal)\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\", \"Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/adventure-bound>https://www.deepcreek.com/vacation-rentals/adventure-bound</a> | 46 | 3.913 | 3 | 5 | 14 | None |\n",
"| e2el5x-rci-581 | Altitude Adjustment | 39.53566 | -79.37087 | 0 | 24 | 0 | 0 | [\"Golf Area\", \"Lake Area\"] | [\"Signature Collection Home\", \"CARC\", \"A/C\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"WIFI\", \"EV Charging\"] | [\"House\"] | [\"Biltmore at Lodestone\"] | [\"A/C (Central)\", \"Signature Collection Home\", \"CARC Indoor Pool & Fitness Membership\", \"Dog Friendly\", \"A/C\", \"All Bedrooms Are Suites\", \"Fireplace\", \"Fireplace (Gas)\", \"Game Table\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"WIFI\", \"No Bunk Beds\", \"Electric Vehicle Charging Station\"] | <a href=https://www.deepcreek.com/vacation-rentals/altitude-adjustment>https://www.deepcreek.com/vacation-rentals/altitude-adjustment</a> | 82 | 4.8415 | 5 | 5 | 14 | [\"1\"] |\n",
"| e2el5x-rci-585 | American Eagle Lodge | 39.55831 | -79.35635 | 0 | 24 | 0 | 0 | [\"Lake Front\", \"Ski Area\"] | [\"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"Swimming Pool\", \"WIFI\", \"Sauna\"] | [\"House\"] | [\"Deep Creek Drive\"] | [\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Gas)\", \"Fireplace (Wood)\", \"Game Table\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"Swimming Pool\", \"Swimming Pool (Private)\", \"WIFI\", \"Sauna\", \"No Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/american-eagle-lodge>https://www.deepcreek.com/vacation-rentals/american-eagle-lodge</a> | 41 | 4.4146 | 7 | 8 | 26 | [\"2\"] |\n",
"| e2el5x-rci-589 | Almost Aspen | 39.501404 | -79.32321 | 0 | 24 | 0 | 0 | [\"Lake Front\"] | [\"Signature Collection Home\", \"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\"] | [\"House\"] | [\"Glendale Rd.\"] | [\"A/C (Central)\", \"Signature Collection Home\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Gas)\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"WIFI\", \"Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/almost-aspen>https://www.deepcreek.com/vacation-rentals/almost-aspen</a> | 55 | 4.6909 | 6 | 7 | 20 | [\"1\"] |\n",
"| e2el5x-rci-592 | At Lake's Edge | 39.50574 | -79.277855 | 0 | 24 | 0 | 0 | [\"Golf Area\", \"Lake Front\"] | [\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"Weddings Considered (Fees Apply)\", \"WIFI\"] | [\"House\"] | [\"Waterfront Greens\"] | [\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"Weddings Considered (Fees Apply)\", \"WIFI\", \"No Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/lakes-edge>https://www.deepcreek.com/vacation-rentals/lakes-edge</a> | 37 | 4.3784 | 7 | 8 | 20 | [\"1\"] |\n",
"| e2el5x-rci-594 | Awesome View | 39.501785 | -79.32087 | 0 | 24 | 0 | 0 | [\"Lake Front\"] | [\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Swimming Pool\", \"WIFI\"] | [\"House\"] | [\"Glendale Rd.\"] | [\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"A/C\", \"Dock\", \"Dock (Private)\", \"Fireplace\", \"Fireplace (Gas)\", \"Fireplace (Wood)\", \"Game Table\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Swimming Pool\", \"Swimming Pool (Private)\", \"WIFI\", \"No Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/awesome-view>https://www.deepcreek.com/vacation-rentals/awesome-view</a> | 33 | 4.0606 | 6 | 8 | 24 | [\"1\"] |\n",
"| e2el5x-rci-606 | Beyond Bliss | 39.50577 | -79.27956 | 0 | 24 | 0 | 0 | [\"Golf Area\", \"Lake Front\"] | [\"Signature Collection Home\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Grill\", \"Home Theater\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Swimming Pool\", \"Weddings Considered (Fees Apply)\", \"WIFI\"] | [\"House\"] | [\"Waterfront Greens\"] | [\"A/C (Central)\", \"Signature Collection Home\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"All Bedrooms Are Suites\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Gas)\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Gas)\", \"Home Theater\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Swimming Pool\", \"Swimming Pool (Private)\", \"Weddings Considered (Fees Apply)\", \"WIFI\", \"No Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/beyond-bliss>https://www.deepcreek.com/vacation-rentals/beyond-bliss</a> | 37 | 4.2703 | 9 | 8 | 20 | [\"1\"] |\n",
"+----------------+----------------------+-----------+------------+--------------------+----------------+---------+--------------------------+-------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+---------------+----------------+-------+------+-----------------+--------------+\n",
"Truncated to displaylimit of 10."
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [ "source": [
"%%sql\n", "%%sql\n",
"# Add your select statement here\n",
"SELECT * from all_railey_properties"
"# Add your select statement here"
] ]
}, },
{ {
@ -548,311 +266,80 @@
"# Your SQL goes here" "# Your SQL goes here"
] ]
}, },
{
"cell_type": "markdown",
"id": "51787413-b452-4c8f-97ce-fd8983f2300b",
"metadata": {},
"source": [
"### I LIKE you <3\n",
"\n",
"SQL also has some other boolean operators besides the classics. The most important of these which we'll cover is LIKE. LIKE allows you to search for strings which match a particular pattern. As an example, take our hypothetical taxi example from before. Imagine we have a column called `destination_address`. We could use a LIKE statement to search for all destinations which are on a particular street. I'll show you what it looks like and then we'll go from there:\n",
"\n",
"`SELECT * FROM cab_rides WHERE destination_address LIKE '%Main St%'`\n",
"\n",
"This SQL query will match entries like \"122 Main Street\", \"57 Main St.\", and \"3232 Main Street\". The `%` sign means match any characters. So here we tell the database to search for address which start with any characters, then are followed by \"Main St\", and finally has any number of characters at the end. This can be useful to have some basic search engine type functionality."
]
},
{
"cell_type": "markdown",
"id": "c4a3a89c-448c-41cc-82e7-0b911def9fc6",
"metadata": {},
"source": [
"### Exercise 6: WHERE is the person I LIKE?\n",
"\n",
"Now use your knowledge of LIKE to write a SQL query to pull out all deep creek homes which have \"Lake\" in the house's `name` column."
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11,
"id": "fbece4d1-877e-4bc9-991e-54374da179b0",
"execution_count": null,
"id": "659ee93a-e99a-4168-8c51-53e385b092d3",
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"# Your SQL goes here"
]
},
{
"cell_type": "markdown",
"id": "b61ec4d0-b45a-4ec5-b47e-3732e4df086b",
"metadata": {}, "metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<span style=\"None\">Running query in &#x27;sqlite:///properties.db&#x27;</span>"
],
"text/plain": [
"Running query in 'sqlite:///properties.db'"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<table>\n",
" <thead>\n",
" <tr>\n",
" <th>id</th>\n",
" <th>name</th>\n",
" <th>latitude</th>\n",
" <th>longitude</th>\n",
" <th>prioritize_listing</th>\n",
" <th>min_rental_age</th>\n",
" <th>promote</th>\n",
" <th>property_search_priority</th>\n",
" <th>access_types</th>\n",
" <th>featured_amenities</th>\n",
" <th>home_type</th>\n",
" <th>neighborhood</th>\n",
" <th>all_amenities</th>\n",
" <th>url</th>\n",
" <th>reviews_count</th>\n",
" <th>reviews_rating</th>\n",
" <th>baths</th>\n",
" <th>beds</th>\n",
" <th>total_occupants</th>\n",
" <th>shared_baths</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>e2el5x-rci-592</td>\n",
" <td>At Lake's Edge</td>\n",
" <td>39.50574</td>\n",
" <td>-79.277855</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Golf Area\", \"Lake Front\"]</td>\n",
" <td>[\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"Weddings Considered (Fees Apply)\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Waterfront Greens\"]</td>\n",
" <td>[\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"Weddings Considered (Fees Apply)\", \"WIFI\", \"No Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/lakes-edge>https://www.deepcreek.com/vacation-rentals/lakes-edge</a></td>\n",
" <td>37</td>\n",
" <td>4.3784</td>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" <td>20</td>\n",
" <td>[\"1\"]</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-625</td>\n",
" <td>Chalet By The Lake</td>\n",
" <td>39.55737</td>\n",
" <td>-79.35986</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Ski Area\", \"Lake Access\"]</td>\n",
" <td>[\"CARC\", \"A/C\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Lake Pointe\"]</td>\n",
" <td>[\"A/C (Central)\", \"CARC Indoor Pool & Fitness Membership\", \"A/C\", \"All Bedrooms Are Suites\", \"Fireplace\", \"Fireplace (Gas)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"WIFI\", \"Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/chalet-lake>https://www.deepcreek.com/vacation-rentals/chalet-lake</a></td>\n",
" <td>33</td>\n",
" <td>4.5758</td>\n",
" <td>3</td>\n",
" <td>3</td>\n",
" <td>8</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-647</td>\n",
" <td>Enchanted Lakefront</td>\n",
" <td>39.501686</td>\n",
" <td>-79.32188</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Lake Front\"]</td>\n",
" <td>[\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Glendale Rd.\"]</td>\n",
" <td>[\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"A/C\", \"Dock\", \"Dock (Private)\", \"Fireplace\", \"Fireplace (Gas)\", \"Fireplace (Wood)\", \"Game Table\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"WIFI\", \"No Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/enchanted-lakefront>https://www.deepcreek.com/vacation-rentals/enchanted-lakefront</a></td>\n",
" <td>36</td>\n",
" <td>4.3889</td>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" <td>22</td>\n",
" <td>[\"1\"]</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-672</td>\n",
" <td>Lake Chalet</td>\n",
" <td>39.50114</td>\n",
" <td>-79.31453</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Lake Area\"]</td>\n",
" <td>[\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Pool Table\", \"Streaming Capable TVs\", \"WIFI\", \"Cabin\"]</td>\n",
" <td>None</td>\n",
" <td>[\"Yellowstone\"]</td>\n",
" <td>[\"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C (Central)\", \"CARC Indoor Pool & Fitness Membership\", \"A/C\", \"Fireplace\", \"Fireplace (Wood)\", \"Game Table\", \"Grill\", \"Grill (Charcoal)\", \"Hot Tub\", \"Pool Table\", \"Streaming Service Capable TVs\", \"WIFI\", \"No Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/lake-chalet>https://www.deepcreek.com/vacation-rentals/lake-chalet</a></td>\n",
" <td>36</td>\n",
" <td>4.4444</td>\n",
" <td>4</td>\n",
" <td>4</td>\n",
" <td>12</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-675</td>\n",
" <td>Lake 'N Logs</td>\n",
" <td>39.499172</td>\n",
" <td>-79.28665</td>\n",
" <td>0</td>\n",
" <td>30</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Lake Front\"]</td>\n",
" <td>[\"Signature Collection Home\", \"A/C\", \"Dock\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Beckman's Peninsula\"]</td>\n",
" <td>[\"Signature Collection Home\", \"A/C (Central)\", \"A/C\", \"Dock\", \"Dock (Private)\", \"Fireplace\", \"Fireplace (Gas)\", \"Game Table\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"WIFI\", \"Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/lake-n-logs>https://www.deepcreek.com/vacation-rentals/lake-n-logs</a></td>\n",
" <td>32</td>\n",
" <td>4.9063</td>\n",
" <td>3</td>\n",
" <td>5</td>\n",
" <td>14</td>\n",
" <td>[\"1\"]</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-683</td>\n",
" <td>Lake Effect</td>\n",
" <td>39.500214</td>\n",
" <td>-79.27337</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Lake Front\"]</td>\n",
" <td>[\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Harvey's Peninsula\"]</td>\n",
" <td>[\"A/C (Partial)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"Dog Friendly\", \"A/C\", \"Dock\", \"Dock (Private)\", \"Fireplace\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"WIFI\", \"Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/lake-effect>https://www.deepcreek.com/vacation-rentals/lake-effect</a></td>\n",
" <td>43</td>\n",
" <td>4.5581</td>\n",
" <td>3</td>\n",
" <td>3</td>\n",
" <td>10</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-738</td>\n",
" <td>The Lakehouse</td>\n",
" <td>39.501854</td>\n",
" <td>-79.32005</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Lake Front\"]</td>\n",
" <td>[\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Silver Tree Landing\"]</td>\n",
" <td>[\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"Dog Friendly\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Gas)\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"WIFI\", \"No Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/lakehouse>https://www.deepcreek.com/vacation-rentals/lakehouse</a></td>\n",
" <td>13</td>\n",
" <td>4.5385</td>\n",
" <td>6</td>\n",
" <td>8</td>\n",
" <td>22</td>\n",
" <td>[\"1\"]</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-826</td>\n",
" <td>On Lake Time</td>\n",
" <td>39.498966</td>\n",
" <td>-79.32662</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Lake Area\"]</td>\n",
" <td>[\"Signature Collection Home\", \"A/C\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Pool Table\", \"WIFI\"]</td>\n",
" <td>[\"Duplex\"]</td>\n",
" <td>[\"Timberlake\"]</td>\n",
" <td>[\"A/C (Central)\", \"Signature Collection Home\", \"A/C\", \"Fireplace\", \"Fireplace (Gas)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Pool Table\", \"WIFI\", \"Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/lake-time>https://www.deepcreek.com/vacation-rentals/lake-time</a></td>\n",
" <td>50</td>\n",
" <td>4.44</td>\n",
" <td>4</td>\n",
" <td>5</td>\n",
" <td>12</td>\n",
" <td>[\"1\"]</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-830</td>\n",
" <td>Traditions on the Lake</td>\n",
" <td>39.516163</td>\n",
" <td>-79.32477</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Lake Front\"]</td>\n",
" <td>[\"A/C\", \"Dock\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Streaming Capable TVs\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Route 219 (Garrett Hwy)\"]</td>\n",
" <td>[\"A/C (Central)\", \"A/C\", \"Dock\", \"Dock (Private)\", \"Fireplace\", \"Fireplace (Gas)\", \"Game Table\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Streaming Service Capable TVs\", \"WIFI\", \"Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/traditions-lake>https://www.deepcreek.com/vacation-rentals/traditions-lake</a></td>\n",
" <td>37</td>\n",
" <td>4.3784</td>\n",
" <td>3</td>\n",
" <td>5</td>\n",
" <td>14</td>\n",
" <td>[\"1\"]</td>\n",
" </tr>\n",
" <tr>\n",
" <td>e2el5x-rci-849</td>\n",
" <td>Castle at the Lake</td>\n",
" <td>39.50537</td>\n",
" <td>-79.279144</td>\n",
" <td>0</td>\n",
" <td>24</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>[\"Golf Area\", \"Lake Front\"]</td>\n",
" <td>[\"Signature Collection Home\", \"A/C\", \"Dock\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"Swimming Pool\", \"Weddings Considered (Fees Apply)\", \"WIFI\"]</td>\n",
" <td>[\"House\"]</td>\n",
" <td>[\"Waterfront Greens\"]</td>\n",
" <td>[\"A/C (Central)\", \"Signature Collection Home\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"Swimming Pool\", \"Swimming Pool (Private)\", \"Weddings Considered (Fees Apply)\", \"WIFI\", \"No Bunk Beds\"]</td>\n",
" <td><a href=https://www.deepcreek.com/vacation-rentals/castle-lake>https://www.deepcreek.com/vacation-rentals/castle-lake</a></td>\n",
" <td>61</td>\n",
" <td>4.4754</td>\n",
" <td>5</td>\n",
" <td>5</td>\n",
" <td>14</td>\n",
" <td>[\"1\"]</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<span style=\"font-style:italic;text-align:center;\">Truncated to <a href=\"https://jupysql.ploomber.io/en/latest/api/configuration.html#displaylimit\">displaylimit</a> of 10.</span>"
],
"text/plain": [
"+----------------+------------------------+-----------+------------+--------------------+----------------+---------+--------------------------+-----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+---------------+----------------+-------+------+-----------------+--------------+\n",
"| id | name | latitude | longitude | prioritize_listing | min_rental_age | promote | property_search_priority | access_types | featured_amenities | home_type | neighborhood | all_amenities | url | reviews_count | reviews_rating | baths | beds | total_occupants | shared_baths |\n",
"+----------------+------------------------+-----------+------------+--------------------+----------------+---------+--------------------------+-----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+---------------+----------------+-------+------+-----------------+--------------+\n",
"| e2el5x-rci-592 | At Lake's Edge | 39.50574 | -79.277855 | 0 | 24 | 0 | 0 | [\"Golf Area\", \"Lake Front\"] | [\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"Weddings Considered (Fees Apply)\", \"WIFI\"] | [\"House\"] | [\"Waterfront Greens\"] | [\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"Weddings Considered (Fees Apply)\", \"WIFI\", \"No Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/lakes-edge>https://www.deepcreek.com/vacation-rentals/lakes-edge</a> | 37 | 4.3784 | 7 | 8 | 20 | [\"1\"] |\n",
"| e2el5x-rci-625 | Chalet By The Lake | 39.55737 | -79.35986 | 0 | 24 | 0 | 0 | [\"Ski Area\", \"Lake Access\"] | [\"CARC\", \"A/C\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"WIFI\"] | [\"House\"] | [\"Lake Pointe\"] | [\"A/C (Central)\", \"CARC Indoor Pool & Fitness Membership\", \"A/C\", \"All Bedrooms Are Suites\", \"Fireplace\", \"Fireplace (Gas)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"WIFI\", \"Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/chalet-lake>https://www.deepcreek.com/vacation-rentals/chalet-lake</a> | 33 | 4.5758 | 3 | 3 | 8 | None |\n",
"| e2el5x-rci-647 | Enchanted Lakefront | 39.501686 | -79.32188 | 0 | 24 | 0 | 0 | [\"Lake Front\"] | [\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"WIFI\"] | [\"House\"] | [\"Glendale Rd.\"] | [\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"A/C\", \"Dock\", \"Dock (Private)\", \"Fireplace\", \"Fireplace (Gas)\", \"Fireplace (Wood)\", \"Game Table\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"WIFI\", \"No Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/enchanted-lakefront>https://www.deepcreek.com/vacation-rentals/enchanted-lakefront</a> | 36 | 4.3889 | 7 | 8 | 22 | [\"1\"] |\n",
"| e2el5x-rci-672 | Lake Chalet | 39.50114 | -79.31453 | 0 | 24 | 0 | 0 | [\"Lake Area\"] | [\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Pool Table\", \"Streaming Capable TVs\", \"WIFI\", \"Cabin\"] | None | [\"Yellowstone\"] | [\"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C (Central)\", \"CARC Indoor Pool & Fitness Membership\", \"A/C\", \"Fireplace\", \"Fireplace (Wood)\", \"Game Table\", \"Grill\", \"Grill (Charcoal)\", \"Hot Tub\", \"Pool Table\", \"Streaming Service Capable TVs\", \"WIFI\", \"No Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/lake-chalet>https://www.deepcreek.com/vacation-rentals/lake-chalet</a> | 36 | 4.4444 | 4 | 4 | 12 | None |\n",
"| e2el5x-rci-675 | Lake 'N Logs | 39.499172 | -79.28665 | 0 | 30 | 0 | 0 | [\"Lake Front\"] | [\"Signature Collection Home\", \"A/C\", \"Dock\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"WIFI\"] | [\"House\"] | [\"Beckman's Peninsula\"] | [\"Signature Collection Home\", \"A/C (Central)\", \"A/C\", \"Dock\", \"Dock (Private)\", \"Fireplace\", \"Fireplace (Gas)\", \"Game Table\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"WIFI\", \"Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/lake-n-logs>https://www.deepcreek.com/vacation-rentals/lake-n-logs</a> | 32 | 4.9063 | 3 | 5 | 14 | [\"1\"] |\n",
"| e2el5x-rci-683 | Lake Effect | 39.500214 | -79.27337 | 0 | 24 | 0 | 0 | [\"Lake Front\"] | [\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"WIFI\"] | [\"House\"] | [\"Harvey's Peninsula\"] | [\"A/C (Partial)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"Dog Friendly\", \"A/C\", \"Dock\", \"Dock (Private)\", \"Fireplace\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"WIFI\", \"Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/lake-effect>https://www.deepcreek.com/vacation-rentals/lake-effect</a> | 43 | 4.5581 | 3 | 3 | 10 | None |\n",
"| e2el5x-rci-738 | The Lakehouse | 39.501854 | -79.32005 | 0 | 24 | 0 | 0 | [\"Lake Front\"] | [\"CARC\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"A/C\", \"Dock\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"WIFI\"] | [\"House\"] | [\"Silver Tree Landing\"] | [\"A/C (Central)\", \"Provides Firewood (Valid: 9/15 - 4/15)\", \"CARC Indoor Pool & Fitness Membership\", \"Dog Friendly\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Fireplace\", \"Fireplace (Gas)\", \"Fireplace (Wood)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"WIFI\", \"No Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/lakehouse>https://www.deepcreek.com/vacation-rentals/lakehouse</a> | 13 | 4.5385 | 6 | 8 | 22 | [\"1\"] |\n",
"| e2el5x-rci-826 | On Lake Time | 39.498966 | -79.32662 | 0 | 24 | 0 | 0 | [\"Lake Area\"] | [\"Signature Collection Home\", \"A/C\", \"Fireplace\", \"Grill\", \"Hot Tub\", \"Pool Table\", \"WIFI\"] | [\"Duplex\"] | [\"Timberlake\"] | [\"A/C (Central)\", \"Signature Collection Home\", \"A/C\", \"Fireplace\", \"Fireplace (Gas)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Pool Table\", \"WIFI\", \"Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/lake-time>https://www.deepcreek.com/vacation-rentals/lake-time</a> | 50 | 4.44 | 4 | 5 | 12 | [\"1\"] |\n",
"| e2el5x-rci-830 | Traditions on the Lake | 39.516163 | -79.32477 | 0 | 24 | 0 | 0 | [\"Lake Front\"] | [\"A/C\", \"Dock\", \"Fireplace\", \"Game Table\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Streaming Capable TVs\", \"WIFI\"] | [\"House\"] | [\"Route 219 (Garrett Hwy)\"] | [\"A/C (Central)\", \"A/C\", \"Dock\", \"Dock (Private)\", \"Fireplace\", \"Fireplace (Gas)\", \"Game Table\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Streaming Service Capable TVs\", \"WIFI\", \"Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/traditions-lake>https://www.deepcreek.com/vacation-rentals/traditions-lake</a> | 37 | 4.3784 | 3 | 5 | 14 | [\"1\"] |\n",
"| e2el5x-rci-849 | Castle at the Lake | 39.50537 | -79.279144 | 0 | 24 | 0 | 0 | [\"Golf Area\", \"Lake Front\"] | [\"Signature Collection Home\", \"A/C\", \"Dock\", \"Grill\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Capable TVs\", \"Swimming Pool\", \"Weddings Considered (Fees Apply)\", \"WIFI\"] | [\"House\"] | [\"Waterfront Greens\"] | [\"A/C (Central)\", \"Signature Collection Home\", \"A/C\", \"Dock\", \"Dock (Slip)\", \"Grill\", \"Grill (Gas)\", \"Hot Tub\", \"Outdoor Fireplace or Fire Pit\", \"Pool Table\", \"Streaming Service Capable TVs\", \"Swimming Pool\", \"Swimming Pool (Private)\", \"Weddings Considered (Fees Apply)\", \"WIFI\", \"No Bunk Beds\"] | <a href=https://www.deepcreek.com/vacation-rentals/castle-lake>https://www.deepcreek.com/vacation-rentals/castle-lake</a> | 61 | 4.4754 | 5 | 5 | 14 | [\"1\"] |\n",
"+----------------+------------------------+-----------+------------+--------------------+----------------+---------+--------------------------+-----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+---------------+----------------+-------+------+-----------------+--------------+\n",
"Truncated to displaylimit of 10."
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"### Sorting with ORDER BY\n",
"\n",
"Right now the SQL results returned to you are unsorted, but you can absolutely choose the sorting method that the database can use before it returns the rows to you. To accomplish this with SQL one should use the ORDER BY directive at the end of the SELECT statement. Imagine I would like to sort all hypothetical taxi rides by total_miles_traveled when they are returned. I can write a query which looks like this: `SELECT * FROM cab_rides ORDER BY total_miles_traveled DESC`. After you specify the column name you'd like to use to sort, you can also specify ASC or DESC to sort in ascending or decending order. By defualt, SQL databases with use an ascending sort but you can change that.\n",
"\n",
"You can also specify multiple ORDER BY clauses to sort by multiple columns at the same time, just like in excel. For example you could hit the SQL database with one of these to first sort by last name and then sort by first name when pulling records out: `SELECT * FROM cab_rides ORDER BY last_name ORDER BY first_name`. "
]
},
{
"cell_type": "markdown",
"id": "5dbcfa6c-cb23-4d88-b208-386c3b20c81e",
"metadata": {},
"source": [
"### Exercise 7: Where are the beds?\n",
"\n",
"Let's try another exercise, this time to sort the results by the amount of `beds` they have. Make sure you sort it so that we see the properties with the largest number of beds."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5677985f-7a94-4df6-adc9-c5c0ebad48f0",
"metadata": {},
"outputs": [],
"source": [ "source": [
"%%sql\n", "%%sql\n",
"SELECT * from all_railey_properties WHERE name LIKE '%Lake%'"
"# Your SQL goes here"
] ]
} }
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "jupyterwithpackages",
"display_name": ".venv",
"language": "python", "language": "python",
"name": "jupyterwithpackages"
"name": ".venv"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
@ -864,7 +351,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.11.6"
}, },
"toc-autonumbering": true, "toc-autonumbering": true,
"toc-showmarkdowntxt": false "toc-showmarkdowntxt": false

Loading…
Cancel
Save