<commit_before><!doctype html>
<html lang="en">

    <head>
        <meta charset="utf-8">

        <title>Introduction to SQL</title>

        <meta name="description" content="Introduction to SQL presentation for the LBS Technology Club">
        <meta name="author" content="<NAME>">

        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

        <link rel="stylesheet" href="css/reveal.min.css">
        <link rel="stylesheet" href="css/theme/q.css" id="theme">

        <!-- For syntax highlighting -->
        <link rel="stylesheet" href="lib/css/zenburn.css">

        <!-- If the query includes 'print-pdf', use the PDF print sheet -->
        <script>
            document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
        </script>

        <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.js"></script>
        <![endif]-->
    </head>

    <body>

        <div class="reveal">

            <!-- Any section element inside of this container is displayed as a slide -->
            <div class="slides">
            
                <section>
                    <h1>Introduction to SQL</h1>
                    <h5>Presentation for the LBS Technology Club</h5>
                    <img src="https://pbs.twimg.com/profile_images/260297549/Logo_Tech_Club_Small.jpg" width="120em" height="120em"/>
                    <p>
                        <small><a href="http://github.com/qlim"><NAME></a> / <a href="http://twitter.com/qmanic">@qmanic</a></small>
                    </p>
                    <p><small>This presentation is live at <a href="http://qlim.github.io/sql-intro">http://qlim.github.io/sql-intro</a> (<a href="http://github.com/qlim/sql-intro">src</a>)
                    </small>
                    </p>
                </section>

                <section>
                    <h2>Before we get started</h2>
                    <ul>
                        <li>Download a copy of <a href="http://sqlitestudio.pl/?act=download">SQLiteStudio</a></li>
                        <li>Download a copy of the <a href="http://qlim.github.io/sql-intro/sql-intro.db">sample database</a> we will use today</li>
                        <li>An<a href="http://qlim.github.io/sql-intro/sql-intro-access.accdb">Access version</a> of the database is also available</li>
                    </ul>
                </section>

                <section>
                    <h2>What are we covering today?</h2>
                    <ul>
                        <li>Relational databases - the basics</li>
                        <li>Simple SELECT queries with WHERE, ORDER BY</li>
                        <li>Aggregation - SUM, AVERAGE, COUNT</li>
                        <li>Simple JOINs</li>
                    </ul>
                </section>
                <section>
                    <h2>What are we not covering?</h2>
                    <ul>
                        <li>This is an introduction only!</li>
                        <li>This is not about database design</li>
                        <li>This is a general SQL introduction and not about specific database systems</li>
                        <li>Query builders - they are your friend, don't write SQL unless you have to! But it does help to know what's going on under the hood</li>
                    </ul>
                </section>

                <section>
                    <h2>What is SQL?</h2>

                    <p class="fragment">
                    <strong>S</strong>tructured
                    <strong>Q</strong>uery
                    <strong>L</strong>anguage
                    <br />
                    is a tool for manipuating data in
                    <br />
                    <u>relational databases</u>
                    </p>

                    <figure class="fragment">
                    <pre><code data-trim contenteditable class="language-sql">
SELECT firstName, lastName, countryCode, city
FROM Customers
WHERE countryCode="US";
                    </code></pre>
                    </figure>
                </section>

                <section>
                    <h2>Relational databases are everywhere</h2>
                    <p class="list-lead-in">Some examples of database systems that use SQL</p>
                    <ul class="smaller60">
                        <li>Microsoft Access</li>
                        <li>Microsoft SQL Server</li>
                        <li>Oracle RDBMS</li>
                        <li>IBM DB2</li>
                        <li>SAP Sypbase</li>
                        <li>MySQL</li>
                        <li>PostgreSQL</li>
                        <li>Amazon SimpleDB</li>
                    </ul>
                    <p class="fragment">
                    Although SQL is standardised, differences <strong>do</strong> exist between systems
                    </p>
                    <p class="fragment">
                    We will be using <strong>SQLite</strong> in this tutorial but will be using a basic subset of SQL
                    that is broadly universal
                    </p>
                </section>

                <section>
                    <h2>Why learn SQL?</h2>
                    <p>In business you might want to:</p>
                    <ul>
                        <li><strong>Extract</strong> a subset of data from a larger dataset - 
                        <strong>filter</strong> it to only include data you're interested in and maybe
                        <strong>sort</strong> it while you're at it</li>
                        <li><strong>Transform</strong> data by performing calculations on it</li>
                        <li><strong>Summarise</strong> complex data (e.g. computing sums or averages)</li>
                        <li><strong>Insert</strong> new data or <strong>delete</strong> existing data from a 
                        dataset (out of scope for today)</li>
                    </ul>
                    <p>And of course, databases are at the heart of many mobile and web applications</p>
                </section>

                <section>
                    <h2>What is a relational database?</h2>
                    <p>
                    A relational database is a collection of <strong>tables</strong>,
                    <br />
                    which have <strong>columns</strong> and <strong>rows</strong>

                    <figure class="fragment small">
                    <figcaption>Table: <span class="mono">Customers</span></figcaption>
                    <pre><code data-trim contenteditable class="language-sql">
#|customerId|firstName|lastName |countryCode|city       |tier|joinDate  
-+----------+---------+---------+-----------+-----------+----+----------
1|1         |Andy     |Dwyer    |US         |Pawnee     |3   |2013-01-08
2|2         |Bruce    |Bullerby |GB         |London     |1   |2013-01-21
3|3         |Carrie   |Bradshaw |US         |New York   |2   |2013-03-04
4|4         |D'Angelo |Barksdale|US         |Baltimore  |1   |2013-04-19
...

                    </code></pre>
                    </figure>

                    <figure class="fragment small">
                    <figcaption>Table: <span class="mono">Sales</span></figcaption>
                    <pre><code data-trim contenteditable class="language-sql">
# |transactionId|customerId|productId|timestamp       |quantity|salesValue<commit_msg>Include some comics<commit_after><!doctype html>
<html lang="en">

    <head>
        <meta charset="utf-8">

        <title>Introduction to SQL</title>

        <meta name="description" content="Introduction to SQL presentation for the LBS Technology Club">
        <meta name="author" content="<NAME>">

        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

        <link rel="stylesheet" href="css/reveal.min.css">
        <link rel="stylesheet" href="css/theme/q.css" id="theme">

        <!-- For syntax highlighting -->
        <link rel="stylesheet" href="lib/css/zenburn.css">

        <!-- If the query includes 'print-pdf', use the PDF print sheet -->
        <script>
            document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
        </script>

        <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.js"></script>
        <![endif]-->
    </head>

    <body>

        <div class="reveal">

            <!-- Any section element inside of this container is displayed as a slide -->
            <div class="slides">
            
                <section>
                    <h1>Introduction to SQL</h1>
                    <h5>Presentation for the LBS Technology Club</h5>
                    <img src="https://pbs.twimg.com/profile_images/260297549/Logo_Tech_Club_Small.jpg" width="120em" height="120em"/>
                    <p>
                        <small><a href="http://github.com/qlim"><NAME></a> / <a href="http://twitter.com/qmanic">@qmanic</a></small>
                    </p>
                    <p><small>This presentation is live at <a href="http://qlim.github.io/sql-intro">http://qlim.github.io/sql-intro</a> (<a href="http://github.com/qlim/sql-intro">src</a>)
                    </small>
                    </p>
                </section>

                <section>
                    <h2>Before we get started</h2>
                    <ul>
                        <li>Download a copy of <a href="http://sqlitestudio.pl/?act=download">SQLiteStudio</a></li>
                        <li>Download a copy of the <a href="http://qlim.github.io/sql-intro/sql-intro.db">sample database</a> we will use today</li>
                        <li>An<a href="http://qlim.github.io/sql-intro/sql-intro-access.accdb">Access version</a> of the database is also available</li>
                    </ul>
                </section>

                <section>
                    <h2>What are we covering today?</h2>
                    <ul>
                        <li>Relational databases - the basics</li>
                        <li>Simple SELECT queries with WHERE, ORDER BY</li>
                        <li>Aggregation - SUM, AVERAGE, COUNT</li>
                        <li>Simple JOINs</li>
                    </ul>
                </section>
                <section>
                    <h2>What are we not covering?</h2>
                    <ul>
                        <li>This is an introduction only!</li>
                        <li>This is not about database design</li>
                        <li>This is a general SQL introduction and not about specific database systems</li>
                        <li>Query builders - they are your friend, don't write SQL unless you have to! But it does help to know what's going on under the hood</li>
                    </ul>
                </section>

                <section>
                    <h2>What is SQL?</h2>

                    <p class="fragment">
                    <strong>S</strong>tructured
                    <strong>Q</strong>uery
                    <strong>L</strong>anguage
                    <br />
                    is a tool for manipuating data in
                    <br />
                    <u>relational databases</u>
                    </p>

                    <figure class="fragment">
                    <pre><code data-trim contenteditable class="language-sql">
SELECT firstName, lastName, countryCode, city
FROM Customers
WHERE countryCode="US";
                    </code></pre>
                    </figure>
                </section>

                <section>
                    <h2>Relational databases are everywhere</h2>
                    <p class="list-lead-in">Some examples of database systems that use SQL</p>
                    <ul class="smaller60">
                        <li>Microsoft Access</li>
                        <li>Microsoft SQL Server</li>
                        <li>Oracle RDBMS</li>
                        <li>IBM DB2</li>
                        <li>SAP Sypbase</li>
                        <li>MySQL</li>
                        <li>PostgreSQL</li>
                        <li>Amazon SimpleDB</li>
                    </ul>
                    <p class="fragment">
                    Although SQL is standardised, differences <strong>do</strong> exist between systems
                    </p>
                    <p class="fragment">
                    We will be using <strong>SQLite</strong> in this tutorial but will be using a basic subset of SQL
                    that is broadly universal
                    </p>
                </section>

                <section>
                    <h2>Why learn SQL?</h2>
                    <p>In business you might want to:</p>
                    <ul>
                        <li><strong>Extract</strong> a subset of data from a larger dataset - 
                        <strong>filter</strong> it to only include data you're interested in and maybe
                        <strong>sort</strong> it while you're at it</li>
                        <li><strong>Transform</strong> data by performing calculations on it</li>
                        <li><strong>Summarise</strong> complex data (e.g. computing sums or averages)</li>
                        <li><strong>Insert</strong> new data or <strong>delete</strong> existing data from a 
                        dataset (out of scope for today)</li>
                    </ul>
                    <p>And of course, databases are at the heart of many mobile and web applications</p>
                </section>

                <section>
                    <h2>Why learn SQL</h2>
                    <p>
                    <img src="http://imgs.xkcd.com/comics/exploits_of_a_mom.png" />
                    </p>
                    <p>
                    <a href="http://dilbert.com/strips/comic/1995-11-17/" title="Dilbert.com"><img src="http://dilbert.com/dyn/str_strip/000000000/00000000/0000000/000000/20000/1000/100/21168/21168.strip.gif" border="0" alt="Dilbert.com" /></a>
                    </p>
                </section>

                <section>
                    <h2>What is a relational database?</h2>
                    <p>
                    A relational database is a collection of <strong>tables</strong>,
                    <br />
                    which have <strong>columns</strong> and <strong>rows</strong>

                    <figure class="fragment small">
                    <figcaption>Table: <span class="mono">Customers</span></figcaption>
                    <pre><code data-trim contenteditable class="language-sql">
#|customerId|firstName|lastName |countryCode|city       |tier|joinDate  
-+----------+---------+---------+-----------+-----------+----+----------
1|1         |Andy     |Dwyer    |US         |Pawnee     |3   |2013-01-08
2|2         |Bruce    |Bullerby |GB         |London     |1   |2013-01-21
3|3         |Carrie   |Bradshaw |US         |New York   |2   |2013-03-04
4|4         |D'Angelo |Barksdale|US         |Baltimore  |1   |2013-04-19
...

                    </code></pre>
                    </figure>

                    <figure class="fragment small">
                    <figcaption>Table: <span class="mono">Sales</span></figcaption>
                    <pre><code data-trim contenteditable class="language-sql">
# |transactionId|customerId|productId|timestamp       |quantity|salesValue
{'fraction_non_alphanumeric': 0.1322169457635591, 'fraction_numerical': 0.014808797800549863, 'mean_word_length': 1.3620129870129871, 'pattern_counts': {'":': 0, '<': 441, '<?xml version=': 0, '>': 441, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 3, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1109131', 'n_tokens_mistral': 4566, 'n_tokens_neox': 4086, 'n_words': 1047}