Difference between revisions of "SQLite"

From ArchWiki
Jump to: navigation, search
m (needed categorizing)
m (Indent code)
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[Category:Database management systems (English)]]
+
[[Category:Database management systems]]
{{i18n|Sqlite3}}
+
 
+
 
== About ==
 
== About ==
 
SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. The source code for SQLite is in the public domain.
 
SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. The source code for SQLite is in the public domain.
Line 24: Line 22:
  
 
== Installation ==
 
== Installation ==
  $ pacman -S sqlite3
+
  $ pacman -S sqlite
  
 
=== Related Packages ===
 
=== Related Packages ===
* '''core/sqlite3-doc''' - most of the static HTML files that comprise this website, including all of the SQL Syntax and the C/C++ interface specs and other miscellaneous documentation
+
* '''extra/sqlite-doc''' - most of the static HTML files that comprise this website, including all of the SQL Syntax and the C/C++ interface specs and other miscellaneous documentation
 
* '''extra/php-sqlite''' - sqlite3 module for PHP
 
* '''extra/php-sqlite''' - sqlite3 module for PHP
 
* '''community/gambas2-gb-db-sqlite3''' - Gambas2 Sqlite3 database access component
 
* '''community/gambas2-gb-db-sqlite3''' - Gambas2 Sqlite3 database access component
Line 36: Line 34:
  
 
==== Create a database ====
 
==== Create a database ====
sqlite3 archdatabase
+
sqlite3 archdatabase
  
 
==== Create Table ====
 
==== Create Table ====
sqlite> create table tblone(one varchar(10), two smallint);
+
sqlite> create table tblone(one varchar(10), two smallint);
  
 
==== Insert Data ====
 
==== Insert Data ====
sqlite> insert into tblone values('helloworld',20);
+
sqlite> insert into tblone values('helloworld',20);
sqlite> insert into tblone values('archlinux', 30);
+
sqlite> insert into tblone values('archlinux', 30);
  
 
==== Search Database ====
 
==== Search Database ====
sqlite> select * from tblone;
+
sqlite> select * from tblone;
helloworld|20
+
helloworld|20
archlinux|30
+
rchlinux|30
  
 
See the [http://www.sqlite.org/sqlite.html sqlite docs].
 
See the [http://www.sqlite.org/sqlite.html sqlite docs].

Revision as of 12:44, 20 October 2012

About

SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. The source code for SQLite is in the public domain.

Features

From: SQLite Features

  • Transactions are atomic, consistent, isolated, and durable even after system crashes and power failures.
  • Zero-configuration - no setup or administration needed.
  • Implements most of SQL92.
  • A complete database is stored in a single cross-platform disk file.
  • Supports terabyte-sized databases and gigabyte-sized strings and blobs.
  • Small code footprint: less than 325KiB fully configured or less than 190KiB with optional features omitted.
  • Faster than popular client/server database engines for most common operations.
  • Simple, easy to use API.
  • Written in ANSI-C. TCL bindings included. Bindings for dozens of other languages available separately.
  • Well-commented source code with 100% branch test coverage.
  • Available as a single ANSI-C source-code file that you can easily drop into another project.
  • Self-contained: no external dependencies.
  • Cross-platform: Unix (Linux and Mac OS X), OS/2, and Windows (Win32 and WinCE) are supported out of the box. Easy to port to other systems.
  • Sources are in the public domain. Use for any purpose.
  • Comes with a standalone command-line interface (CLI) client that can be used to administer SQLite databases.

Installation

$ pacman -S sqlite

Related Packages

  • extra/sqlite-doc - most of the static HTML files that comprise this website, including all of the SQL Syntax and the C/C++ interface specs and other miscellaneous documentation
  • extra/php-sqlite - sqlite3 module for PHP
  • community/gambas2-gb-db-sqlite3 - Gambas2 Sqlite3 database access component
  • community/sqliteman - The best developer's and/or admin's GUI tool for Sqlite3 in the world

Using sqlite3 command line shell

The SQLite library includes a simple command-line utility named sqlite3 that allows the user to manually enter and execute SQL commands against an SQLite database.

Create a database

sqlite3 archdatabase

Create Table

sqlite> create table tblone(one varchar(10), two smallint);

Insert Data

sqlite> insert into tblone values('helloworld',20);
sqlite> insert into tblone values('archlinux', 30);

Search Database

sqlite> select * from tblone;
helloworld|20
rchlinux|30

See the sqlite docs.

Using sqlite in shell script

See forum post

External Links