SQLITE3 Commands Cheat Sheet

Here is a cli commands cheat sheet for SQLITE3 command, you can use this as a quick reminder for basic commands with a brief description for each of the commands.

What is SQLITE3 command?

Add some data here

        ---
tags: [ database ]
---
# To create database and launch interactive shell:
sqlite3 

# To create table:
sqlite3  "create table os(id integer primary key, name text, year integer);"

# To insert data:
sqlite3  "insert into 'os' values(1,'linux',1991);"

# To list tables:
sqlite3  ".tables"

# To describe table:
sqlite3  ".schema 'os'"

# To view records in table:
sqlite3  "select * from 'os';"

# To view records in table conditionally:
sqlite3  "select * from 'os' where year='1991';"

# To view records with fuzzy matching:
sqlite3  "select * from 'os' where year like '19%';"

# To create a table named `cities` and import a csv into it:
sqlite3  ".import /path/to/city.csv cities"
    

Check out the SQLITE3 command documentation .


You can also check our MegaSh cheatsheet tool, that has 150+ searchable linux cheat sheets in one page, so you never forget a command as you work again

Check Also

Best AI tools list