Download create_db.py from jankip20/sql-env: direct link, hf CLI and curl.
- Browser
- Download file 947 Bytes
-
https://huggingface.co/spaces/jankip20/sql-env/resolve/main/create_db.py
- Command line
-
hf download hf://spaces/jankip20/sql-env/create_db.py
-
curl -L -o create_db.py https://huggingface.co/spaces/jankip20/sql-env/resolve/main/create_db.py
947 Bytes
| import sqlite3 | |
| conn = sqlite3.connect("sql_env.db") | |
| cursor = conn.cursor() | |
| # Create tables | |
| cursor.executescript(""" | |
| CREATE TABLE IF NOT EXISTS employees ( | |
| id INTEGER PRIMARY KEY, | |
| name TEXT NOT NULL, | |
| department TEXT, | |
| salary REAL | |
| ); | |
| CREATE TABLE IF NOT EXISTS departments ( | |
| id INTEGER PRIMARY KEY, | |
| name TEXT NOT NULL, | |
| budget REAL | |
| ); | |
| INSERT INTO departments VALUES (1, 'Engineering', 500000); | |
| INSERT INTO departments VALUES (2, 'Marketing', 200000); | |
| INSERT INTO departments VALUES (3, 'HR', 150000); | |
| INSERT INTO employees VALUES (1, 'Alice', 'Engineering', 95000); | |
| INSERT INTO employees VALUES (2, 'Bob', 'Engineering', 88000); | |
| INSERT INTO employees VALUES (3, 'Carol', 'Marketing', 72000); | |
| INSERT INTO employees VALUES (4, 'Dave', 'HR', 65000); | |
| INSERT INTO employees VALUES (5, 'Eve', 'Marketing', 78000); | |
| """) | |
| conn.commit() | |
| conn.close() | |
| print("✓ sql_env.db created successfully") |