Not able to get the SQL code to run locally, though previous parts of the mission work

Screen Link:

My Code:

import sqlite3
import pandas as pd

conn = sqlite3.connect('chinook.db')

q = """
CREATE VIEW chinook.customer_gt_90_dollars AS 
    SELECT
        c.*
    FROM chinook.invoice i
    INNER JOIN chinook.customer c ON i.customer_id = c.customer_id
    GROUP BY 1
    HAVING SUM(i.total) > 90;
SELECT * FROM chinook.customer_gt_90_dollars;
"""

pd.read_sql_query(q,conn)

What I expected to happen:
I have been able to run all the SQL code, up to this point, in the course in a Jupyter Notebook (where I take notes), so I assumed this would work.

What actually happened:

DatabaseError: Execution failed on sql '
CREATE VIEW chinook.customer_gt_90_dollars AS 
    SELECT
        c.*
    FROM chinook.invoice i
    INNER JOIN chinook.customer c ON i.customer_id = c.customer_id
    GROUP BY 1
    HAVING SUM(i.total) > 90;
SELECT * FROM chinook.customer_gt_90_dollars;
': unknown database chinook

Any thoughts on how to make this work in my notebook?

Based on the error message provided it looks as your code can’t find the file chinook.db.

Have you saved the file in the same folder as the notebook?

Yes, it is in the same directory. I wonder if using sqlite3 is the issue. The conn variable is the instance of the sqlite3.connect('chinook.db'). I tried in place of the chinook in the query and got another error.

You might need the chinook reference out of the query?

I had to change it to the following to make it work:

import sqlite3
import pandas as pd

conn = sqlite3.connect('chinook.db')

q1 = """
CREATE VIEW customer_gt_90_dollars AS 
    SELECT
        c.*
    FROM invoice i
    INNER JOIN customer c ON i.customer_id = c.customer_id
    GROUP BY 1
    HAVING SUM(i.total) > 90;
    """
q2 = """    
SELECT * FROM customer_gt_90_dollars;
"""

conn.execute(q1)
pd.read_sql_query(q2,conn)

That worked!!
Thanks!