<jupyter_start><jupyter_text>Set-Up<jupyter_code>import sqlite3
import pandas as pd
conn = sqlite3.connect('../data/data.db')
c = conn.cursor()

def execute_statement(statement):
    c.execute(statement)
    res = c.fetchall()
    column_names = [description[0] for description in c.description]
    return pd.DataFrame(res, columns=column_names)<jupyter_output><empty_output><jupyter_text>WHEREWHERE clauses can be used to filter out results. There are several different operators that can be used in a WHERE clause:| Operator | Description || --- | --- || = | Equal || > | Greater than || < | Less than || >= | Greater than or equal || <= | Less than or equal ||  | Not equal || BETWEEN | Between a certain range || LIKE | Search for a pattern || IN | To specify multiple possible values for a column |Below is a basic example of the equals operator.<jupyter_code>execute_statement('SELECT Importer, Exporter, Taxon FROM cites WHERE Importer = "GB"')<jupyter_output><empty_output><jupyter_text>The BETWEEN operator works slightly differently to other operators, in that you need to specify two values and include AND between them. This is shown below.<jupyter_code>execute_statement('SELECT Year, Taxon, Importer, Exporter FROM cites WHERE Year BETWEEN 2000 AND 2005')
The IN operator als<jupyter_output><empty_output><jupyter_text>Combining WHERE Clauses<jupyter_code>execute_statement('SELECT Importer, Exporter, Taxon FROM cites WHERE Importer = "GB" AND Exporter = "US"')
execute_statement('SELECT Importer, Exporter, Taxon FROM cites WHERE Importer = "GB" AND (Exporter = "US" OR Exporter = "CA")')
execute_statement('SELECT Appendix, Taxon FROM cites WHERE NOT Appendix = "II"')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10256410256410256, 'fraction_numerical': 0.00641025641025641, 'mean_word_length': 5.733333333333333, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '429603', 'license': 'MIT', 'n_tokens_mistral': 519, 'n_tokens_neox': 489, 'n_words': 176, 'path': 'examples/WHERE.ipynb', 'repo_name': 'CurtisThompson/sql-examples', 'size': '1716'}