Preface and Setup

  • ID: DBSQL-F-L01
  • Type: Preface
  • Audience: Public
  • Theme: Building the data backbone

Relational databases are formal systems for structuring data Codd (1970).

This track focuses on structural clarity before analysis.


Connecting to SQLite

import sqlite3
import pandas as pd

con = sqlite3.connect("data/cdi-retail.sqlite")
print(con)
<sqlite3.Connection object at 0x11f931990>

The output shows a sqlite3.Connection object.
This is not a server connection. SQLite is file-based and embedded.


Inspecting Tables

tables = pd.read_sql(
    "SELECT name FROM sqlite_master WHERE type='table';",
    con
)
print(tables)
          name
0    customers
1     products
2       orders
3  order_items

This confirms available tables.


Structure → Query → Interpretation