SQLite Notes

Open Specific Database with SQLite:

Note: If you don’t designate a database a temporary one will be created which will ceae to exist when you exit.

sqlite3 database_name.db

Exit Console:

.exit

Open database from SQLite Console:

.open database_name.db

Create Table:

create table your_table(
  id INTEGER PRIMARY KEY,
  name TEXT,
  email TEXT
);

Select Statements:

select * from your_table;

select column1, column2 from your_table;

select * from your_table where name='bob';

select * from your_table where name like '%bob%';

Show Tables:

.tables

Show Schema:

Turns on Headers for all Select Statements
.headers on
Shows the command that created a specific table
.schema your_table

Be the first to comment

Leave a Reply