Skip to content

Instantly share code, notes, and snippets.

@ciatph
Last active September 4, 2022 10:00
Show Gist options
  • Save ciatph/73097c638a957ecfb6470920ba208b83 to your computer and use it in GitHub Desktop.
Save ciatph/73097c638a957ecfb6470920ba208b83 to your computer and use it in GitHub Desktop.
Sqlite3 Quick Cheats

Import a CSV File to Database

# Create a database
sqlite3 mydb.db

# Specify the CSV mode and define a table
.mode csv mytable

# Import a CSV file to mytable
.import somedata.csv mytable

# Confirm the created table
.tables
.schema mytable

# Test running a select query on the table
select * from mytable limit 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment