Imported all the notebooks
[tm351-notebooks.git] / notebooks / m269_sql_notebook / M269 - Python - Blue.ipynb
diff --git a/notebooks/m269_sql_notebook/M269 - Python - Blue.ipynb b/notebooks/m269_sql_notebook/M269 - Python - Blue.ipynb
new file mode 100644 (file)
index 0000000..51224fd
--- /dev/null
@@ -0,0 +1,981 @@
+{
+ "metadata": {
+  "name": "",
+  "signature": "sha256:c372d5517c14784c770b77c43c64ec88410777f278bebf9023ce9843e581b90c"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+  {
+   "cells": [
+    {
+     "cell_type": "heading",
+     "level": 1,
+     "metadata": {},
+     "source": [
+      "M269 Recap - Python"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "If you have completed M269 (a prerequisite course for TM351), you should already be familiar with the idea of SQL, the widely used query language for querying relational databases.\n",
+      "\n",
+      "You will have an opportunity to learn about SQL in far more depth throughout TM351, but for now, let's quickly recap on the exercises from M269."
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "from m269_db import *"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [],
+     "prompt_number": 1
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "One of the tables in the M269 database was called `student`."
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#We can examine the contents of the student table \n",
+      "#by selecting all the data contained in that table in the database\n",
+      "q='''SELECT * FROM student;'''\n",
+      "\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\n",
+        " student_id | student_name | location   | module \n",
+        "------------|--------------|------------|--------\n",
+        " X042       | Yves         | Manchester | M381   \n",
+        " X019       | Sara         | Bristol    | T304   \n",
+        " X020       | Rory         | Manchester | T304   \n",
+        " X048       | Mike         | Bath       | T238   \n",
+        " X018       | Ulla         | London     | M381   \n",
+        " X043       | Willow       | London     | T304   \n",
+        " X025       | Olivia       | York       | T238   \n",
+        " X002       | Mike         | Manchester | M218   \n",
+        " X023       | Petra        | Bristol    | T353   \n",
+        " X008       | Nils         | London     | T353   \n",
+        "\n"
+       ]
+      }
+     ],
+     "prompt_number": 2
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#We can use the column names to restrict which columns of the table we want to look at.\n",
+      "q='''\n",
+      "SELECT student_id, location\n",
+      "FROM student;\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        " student_id | location   \n",
+        "------------|------------\n",
+        " X042       | Manchester \n",
+        " X019       | Bristol    \n",
+        " X020       | Manchester \n",
+        " X048       | Bath       \n",
+        " X018       | London     \n",
+        " X043       | London     \n",
+        " X025       | York       \n",
+        " X002       | Manchester \n",
+        " X023       | Bristol    \n",
+        " X008       | London     \n"
+       ]
+      }
+     ],
+     "prompt_number": 23
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#Write an SQL query which will return the columns student_name and module from the student table.\n",
+      "q='''\n",
+      "\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": true
+     },
+     "outputs": []
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#Choose particular rows of a table using conditions.\n",
+      "#The returned table should contain all the columns in the student table if we use SELECT *.\n",
+      "q='''\n",
+      "SELECT * FROM student WHERE location='Manchester';\n",
+      "'''\n",
+      "\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        " student_id | student_name | location   | module \n",
+        "------------|--------------|------------|--------\n",
+        " X042       | Yves         | Manchester | M381   \n",
+        " X020       | Rory         | Manchester | T304   \n",
+        " X002       | Mike         | Manchester | M218   \n"
+       ]
+      }
+     ],
+     "prompt_number": 21
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#Conditions in the WHERE clause can also be combined with the logical operators AND, OR and NOT.\n",
+      "#So if we wanted to list those rows which contained those students who live\n",
+      "# in Manchester or who are studying module T304, we could use the query:\n",
+      "q='''\n",
+      "SELECT *\n",
+      "FROM student\n",
+      "WHERE location='Manchester' OR module='T304';\n",
+      "'''\n",
+      "\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        " student_id | student_name | location   | module \n",
+        "------------|--------------|------------|--------\n",
+        " X042       | Yves         | Manchester | M381   \n",
+        " X019       | Sara         | Bristol    | T304   \n",
+        " X020       | Rory         | Manchester | T304   \n",
+        " X043       | Willow       | London     | T304   \n",
+        " X002       | Mike         | Manchester | M218   \n"
+       ]
+      }
+     ],
+     "prompt_number": 22
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#Restrict the returned columns by making the required columns explicit in the SELECT clause\n",
+      "\n",
+      "q='''\n",
+      "SELECT student_id, student_name\n",
+      "FROM student\n",
+      "WHERE location='Manchester' OR module='T304';\n",
+      "'''\n",
+      "\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        " student_id | student_name \n",
+        "------------|--------------\n",
+        " X042       | Yves         \n",
+        " X019       | Sara         \n",
+        " X020       | Rory         \n",
+        " X043       | Willow       \n",
+        " X002       | Mike         \n"
+       ]
+      }
+     ],
+     "prompt_number": 25
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {
+      "activity": false,
+      "activityM": true
+     },
+     "source": [
+      "<div class=\"activity\">Activity - Exploring New Tables</div>\n",
+      "\n",
+      "Now try exploring some tables yourself."
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#What are the student identification codes and the names of those students who live in Manchester?\n",
+      "\n",
+      "q='''\n",
+      "\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": true
+     },
+     "outputs": []
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#What are the student identifiers of all the students named Mike?\n",
+      "q='''\n",
+      "SELECT student_id\n",
+      "FROM student\n",
+      "WHERE student_name='Mike';\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": true
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\n",
+        " student_id \n",
+        "------------\n",
+        " X048       \n",
+        " X002       \n",
+        "\n"
+       ]
+      }
+     ],
+     "prompt_number": 3
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#In which towns are there students studying the module T353 or module T238?\n",
+      "q='''\n",
+      "\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": true
+     },
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "The M269 database, m269_db, contains two further tables  - `country` and `language` - which contain much more information than the student table we have looked at so far."
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#Examine the contents of the country table\n",
+      "q='''\n",
+      "select * from country limit 1\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": true
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\n",
+        " iso3166 | country_name | has_capital | capital_city | continent \n",
+        "---------|--------------|-------------|--------------|-----------\n",
+        " AFG     | Afghanistan  | 1           | Kabul        | Asia      \n",
+        "\n"
+       ]
+      }
+     ],
+     "prompt_number": 5
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#Examine the contents of the language table\n",
+      "q='''\n",
+      "\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": true
+     },
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "When we define SQL queries, we typically do so in order to answer a particular question. In many cases, the question to be asked will initially be formulated in natural language terms before being refined and developed as an SQL query. We can also go the other way, expressing SQL queries in more naturalistic terms."
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "<div class=\"activity\">Activity - Interpreting SQL Queries as Natural Language Questions</div>\n",
+      "\n",
+      "Give an equivalent English question that each of the following queries might have been used to answer:\n",
+      "\n",
+      "&nbsp;&nbsp;SELECT *\n",
+      "FROM country\n",
+      "WHERE capital_city='Helsinki';"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {
+      "activity": "activityAns"
+     },
+     "source": [
+      "YOUR ANSWER HERE"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {
+      "activity": "activity"
+     },
+     "source": [
+      "SELECT country_iso\n",
+      "FROM language\n",
+      "WHERE language='Portuguese';"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {
+      "activity": "activityAns"
+     },
+     "source": [
+      "YOUR ANSWER HERE"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {
+      "activity": "activity"
+     },
+     "source": [
+      "SELECT country_name\n",
+      "FROM country\n",
+      "WHERE has_capital=0 AND continent='Asia';"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {
+      "activity": "activityAns"
+     },
+     "source": [
+      "YOUR ANSWER HERE"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "<div class=\"answer\" id=\"ans1\" style=\"display: none\">\n",
+      "Some possible ways of expressing the queries as English questions are:\n",
+      "\n",
+      "<ol type='a'><li>List all the information about the countries whose capital is Helsinki.</li>\n",
+      "<li>List the ISO codes of every country which has Portuguese as an official language.</li>\n",
+      "<li>List the name of every country in Asia which does not have a capital city.</li></ol></div>"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Now try answering a few more questions by making your own queries on to the database:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#What is the capital of Chad?\n",
+      "show(\"SELECT capital_city FROM country WHERE country_name='Chad';\")"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": true
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        "\n",
+        " capital_city \n",
+        "--------------\n",
+        " N'Djamena    \n",
+        "\n"
+       ]
+      }
+     ],
+     "prompt_number": 6
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "<div class=\"answer\"  id='ans2' style=\"display: none\">\n",
+      "SELECT capital_city\n",
+      "FROM country\n",
+      "WHERE country_name='Chad';\n",
+      "</div>"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#List every official language used in the country with the ISO code BOL (Bolivia).\n"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": true
+     },
+     "outputs": [],
+     "prompt_number": 41
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "<div class=\"answer\" id='ans3' style=\"display: none\">\n",
+      "SELECT language\n",
+      "FROM language\n",
+      "WHERE country_iso='BOL';\n",
+      "</div>"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#List the name of every country which is in Europe or North America.\n"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": true
+     },
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {
+      "activity": "activity"
+     },
+     "source": [
+      "<div class=\"answer\" id='ans4' style=\"display: none\">\n",
+      "SELECT country_name\n",
+      "FROM country\n",
+      "WHERE continent='Europe' OR continent='North America';\n",
+      "</div>"
+     ]
+    },
+    {
+     "cell_type": "heading",
+     "level": 2,
+     "metadata": {},
+     "source": [
+      "Exploring another dataset..."
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {
+      "activity": "clear"
+     },
+     "source": [
+      "The m269_db database contains another dataset made up from the tables `man`, `woman`, `married` and `parent`."
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#Explore each of the tables to familiarise yourself with the columns and typical row values\n",
+      "\n",
+      "\n",
+      "\n"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": true
+     },
+     "outputs": [],
+     "prompt_number": 28
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "q='''\n",
+      "SELECT *\n",
+      "FROM person;\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        " person_name \n",
+        "-------------\n",
+        " Gail        \n",
+        " Brian       \n",
+        " Hassan      \n",
+        " Eve         \n",
+        " Freddie     \n",
+        " Jenny       \n",
+        " Indira      \n",
+        " Adam        \n",
+        " Claire      \n",
+        " Dmitri      \n"
+       ]
+      }
+     ],
+     "prompt_number": 31
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "q='''\n",
+      "SELECT *\n",
+      "FROM town;\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        " town_name  \n",
+        "------------\n",
+        " Sunderland \n",
+        " Newcastle  \n",
+        " Bath       \n",
+        " York       \n",
+        " London     \n",
+        " Manchester \n",
+        " Norwich    \n",
+        " Bristol    \n"
+       ]
+      }
+     ],
+     "prompt_number": 30
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "q='''\n",
+      "SELECT *\n",
+      "FROM residence;\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        " person_name | lives_in   \n",
+        "-------------|------------\n",
+        " Gail        | Manchester \n",
+        " Freddie     | Bath       \n",
+        " Indira      | London     \n",
+        " Jenny       | Sunderland \n",
+        " Claire      | Bristol    \n",
+        " Eve         | London     \n",
+        " Brian       | Manchester \n",
+        " Adam        | London     \n",
+        " Hassan      | York       \n",
+        " Dmitri      | Bristol    \n"
+       ]
+      }
+     ],
+     "prompt_number": 32
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Samples of two of the tables have been gathered into separate tables:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "q='''\n",
+      "SELECT *\n",
+      "FROM small_student;\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        " student_id | student_name \n",
+        "------------|--------------\n",
+        " X008       | Mike         \n",
+        " X018       | Rachel       \n",
+        " X043       | Simon        \n"
+       ]
+      }
+     ],
+     "prompt_number": 33
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "q='''\n",
+      "SELECT *\n",
+      "FROM small_parent;\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        " mother | father | child  \n",
+        "--------|--------|--------\n",
+        " Olivia | Mike   | Victor \n",
+        " Rachel | John   | Willow \n"
+       ]
+      }
+     ],
+     "prompt_number": 35
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Do you remember how we can join tables?"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "q='''\n",
+      "SELECT *\n",
+      "FROM small_student CROSS JOIN small_parent;\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        " student_id | student_name | mother | father | child  \n",
+        "------------|--------------|--------|--------|--------\n",
+        " X008       | Mike         | Olivia | Mike   | Victor \n",
+        " X008       | Mike         | Rachel | John   | Willow \n",
+        " X018       | Rachel       | Olivia | Mike   | Victor \n",
+        " X018       | Rachel       | Rachel | John   | Willow \n",
+        " X043       | Simon        | Olivia | Mike   | Victor \n",
+        " X043       | Simon        | Rachel | John   | Willow \n"
+       ]
+      }
+     ],
+     "prompt_number": 36
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#Which students are also fathers?\n",
+      "#We are only interested in those rows where the value in the student_name column is equal to \n",
+      "# the value in the father column:\n",
+      "q='''\n",
+      "SELECT *\n",
+      "FROM small_student CROSS JOIN small_parent \n",
+      "WHERE student_name=father;\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        " student_id | student_name | mother | father | child  \n",
+        "------------|--------------|--------|--------|--------\n",
+        " X008       | Mike         | Olivia | Mike   | Victor \n"
+       ]
+      }
+     ],
+     "prompt_number": 38
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#to answer the question that was actually asked, we might prefer to return only \n",
+      "# the student\u2019s personal identifier and name\n",
+      "q='''\n",
+      "SELECT student_id, student_name\n",
+      "FROM small_student CROSS JOIN small_parent\n",
+      "WHERE student_name=father;\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        " student_id | student_name \n",
+        "------------|--------------\n",
+        " X008       | Mike         \n"
+       ]
+      }
+     ],
+     "prompt_number": 39
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#Examine the tables residence and administration\n",
+      "\n"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": true
+     },
+     "outputs": []
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#Examine the effect of CROSS JOINing them under the condition that lives_in=town\n",
+      "\n"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": true
+     },
+     "outputs": []
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#List the names of those people who live in the county of Somerset.\n",
+      "q='''\n",
+      "SELECT person_name\n",
+      "FROM residence CROSS JOIN administration\n",
+      "WHERE lives_in=town AND county='Somerset';\n",
+      "'''\n",
+      "show(q)"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": false
+     },
+     "outputs": [
+      {
+       "output_type": "stream",
+       "stream": "stdout",
+       "text": [
+        " person_name \n",
+        "-------------\n",
+        " Freddie     \n",
+        " Claire      \n",
+        " Dmitri      \n"
+       ]
+      }
+     ],
+     "prompt_number": 40
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#What column or columns are defined over the same objects in the two tables country and language?\n",
+      "\n"
+     ],
+     "language": "python",
+     "metadata": {
+      "activity": true
+     },
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {
+      "activity": "activity"
+     },
+     "source": [
+      "If you executed the query:\n",
+      "\n",
+      "SELECT *\n",
+      "FROM country CROSS JOIN language\n",
+      "WHERE iso3166=country_iso;\n",
+      "\n",
+      "\n",
+      "what would the names of the columns in the returned table be?"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {
+      "activity": "activityAns"
+     },
+     "source": [
+      "*YOUR ANSWER HERE*"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {
+      "activity": "activity"
+     },
+     "source": [
+      "What would each row tell you?"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {
+      "activity": "activityAns"
+     },
+     "source": [
+      "YOUR ANSWER HERE"
+     ]
+    },
+    {
+     "cell_type": "heading",
+     "level": 3,
+     "metadata": {},
+     "source": [
+      "Where Next?"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "This completes our quick recap of the SQL commands you should recall from M269. SQL is actually a far richer language than we have seen and you will have an opportunity to learn more about it throught the course.\n",
+      "\n",
+      "You will also see how the sorts of operation that can be applied using SQL can also be applied using other data manipulation languages. Developing a good understanding of how data is represented, and the operations that can then be applied to it, in abstract terms is essential if you are to be able to work with data effectively."
+     ]
+    }
+   ],
+   "metadata": {}
+  }
+ ]
+}
\ No newline at end of file