Home arrow Guides arrow SQLite Quick Tutorial
SQLite Quick Tutorial PDF
Tuesday, 31 May 2011
Here is a short tutorial on SQLite.

Install SQLite:

  cd /usr/ports/databases/sqlite3
  make install clean
  rehash

Create a database and also enter console mode:

  sqlite3 example.db

Create a database and and also create a table from command line:

  sqlite example.db "create table person(firstname TEXT, lastname TEXT, age integer);"

Insert data into the database:

  sqlite example.db "insert into person(firstname,lastname) values('john', 'doe');"

Display records from the database:

  sqlite example.db "select * from person";

To see all tables from the database after you've runed:

  sqlite example.db

and you are at sqlite command prompt:

  .tables

To see a particular table use:

  .schema table_name

You can also run the following command from sql prompt to see all tables for a sqlite database:

  SELECT * FROM sqlite_master;

or (in a nicer formatted way):
 
  PRAGMA table_info(tbldata);


Misc commands on console
-------------------------
.q
or .quit - exit the sqlite console.
Last Updated ( Thursday, 23 February 2012 )
 
< Prev   Next >

Other BSD Systems

OpenBSD

Misc

Solaris

Polls

Best BSD firewall?