Dari namanya yaitu SQLite maka kita bisa menebak bahwa SQLite adalah SQL versi Lite yang berarti kecil dan kompak. Memang benar SQLlite adalah database SQL yang kecil dan praktis. SQLite hanyalah sebuah file kecil biasa tetapi dapat difungsikan sebagai database. SQLite tidak memerlukan sebuah server. SQLite cocok untuk penyimpanan data sebuah device yang smart, untuk keperluan caching. SQLite tidak cocok untuk melayani transaksi database yang kompleks. SQLite tidak boleh dibandingkan dengan database server seperti MySQL, SQLite dapat dibandingkan dengan fopen.
Berikut langkah-langkah mencoba SQLite
- Silahkan mendownload sqlite3.exe yang ada di https://www.sqlite.org/download.html dan letakkan di hardisk anda misalnya d:\sqlite3.exe
- Membuat database seperti contoh berikut ini:
D:\qt\dataku>d:\sqlite3.exe dbku
SQLite version 3.8.10.2 2015-05-20 18:17:19
Enter “.help” for usage hints.
sqlite> create table karyawan(karyawan_id int, nama varchar(50));
sqlite> insert into karyawan values(1, “Visia”);
sqlite> insert into karyawan values(2, “Gracia”);
sqlite> insert into karyawan values(3, “Victorine”);
sqlite> select * from karyawan;
1|Visia
2|Gracia
3|Victorine
sqlite> .exitD:\qt\dataku>dir
Volume in drive D is Data
Volume Serial Number is B17C-E100Directory of D:\qt\dataku
07/23/2015 12:36 PM <DIR> .
07/23/2015 12:36 PM <DIR> ..
07/23/2015 12:36 PM 2,048 dbku
- Untuk help dari sqlite adalah seperti berikut ini:
D:\qt\dataku>d:\sqlite3.exe dbku
SQLite version 3.8.10.2 2015-05-20 18:17:19
Enter “.help” for usage hints.
sqlite> .help
.backup ?DB? FILE Backup DB (default “main”) to FILE
.bail on|off Stop after hitting an error. Default OFF
.binary on|off Turn binary output on or off. Default OFF
.clone NEWDB Clone data into NEWDB from the existing database
.databases List names and files of attached databases
.dbinfo ?DB? Show status information about the database
.dump ?TABLE? … Dump the database in an SQL text format
If TABLE specified, only dump tables matching
LIKE pattern TABLE.
.echo on|off Turn command echo on or off
.eqp on|off Enable or disable automatic EXPLAIN QUERY PLAN
.exit Exit this program
.explain ?on|off? Turn output mode suitable for EXPLAIN on or off.
With no args, it turns EXPLAIN on.
.fullschema Show schema and the content of sqlite_stat tables
.headers on|off Turn display of headers on or off
.help Show this message
.import FILE TABLE Import data from FILE into TABLE
.indexes ?TABLE? Show names of all indexes
If TABLE specified, only show indexes for tables
matching LIKE pattern TABLE.
.limit ?LIMIT? ?VAL? Display or change the value of an SQLITE_LIMIT
.load FILE ?ENTRY? Load an extension library
.log FILE|off Turn logging on or off. FILE can be stderr/stdout
.mode MODE ?TABLE? Set output mode where MODE is one of:
ascii Columns/rows delimited by 0x1F and 0x1E
csv Comma-separated values
column Left-aligned columns. (See .width)
html HTML <table> code
insert SQL insert statements for TABLE
line One value per line
list Values delimited by .separator strings
tabs Tab-separated values
tcl TCL list elements
.nullvalue STRING Use STRING in place of NULL values
.once FILENAME Output for the next SQL command only to FILENAME
.open ?FILENAME? Close existing database and reopen FILENAME
.output ?FILENAME? Send output to FILENAME or stdout
.print STRING… Print literal STRING
.prompt MAIN CONTINUE Replace the standard prompts
.quit Exit this program
.read FILENAME Execute SQL in FILENAME
.restore ?DB? FILE Restore content of DB (default “main”) from FILE
.save FILE Write in-memory database into FILE
.scanstats on|off Turn sqlite3_stmt_scanstatus() metrics on or off
.schema ?TABLE? Show the CREATE statements
If TABLE specified, only show tables matching
LIKE pattern TABLE.
.separator COL ?ROW? Change the column separator and optionally the row
separator for both the output mode and .import
.shell CMD ARGS… Run CMD ARGS… in a system shell
.show Show the current values for various settings
.stats on|off Turn stats on or off
.system CMD ARGS… Run CMD ARGS… in a system shell
.tables ?TABLE? List names of tables
If TABLE specified, only list tables matching
LIKE pattern TABLE.
.timeout MS Try opening locked tables for MS milliseconds
.timer on|off Turn SQL timer on or off
.trace FILE|off Output each SQL statement as it is run
.vfsname ?AUX? Print the name of the VFS stack
.width NUM1 NUM2 … Set column widths for “column” mode
Negative values right-justify
sqlite>
Informasi lebih lanjut silahkan mengunjungi:
1. https://www.sqlite.org/.
2. https://www.sqlite.org/docs.html .
Kunjungi www.proweb.co.id untuk menambah wawasan anda.