SQLite Commands
Data Definition Language
1. CREATE
Creates a new table, a view of a table, or other object in database.
2. ALTER
Modifies an existing database object, such as a table.
3. DROP
Deletes an entire table, a view of a table or other object in the database.
Data Manipulation Language
1. INSERT
Creates a record
2. UPDATE
Modifies records
3. DELETE
Deletes records
Data Query Language
1. SELECT
Retrieves certain records from one or more tables
Start SQLite :
- sqlite3
Display Databases :
- .databases
Display Tables :
- .tables
Exit :
- .exit
Create New Database :
- sqlite3 nama_database.db
DataType di Sqlite :
- INTEGER : 1-10
- REAL : 0.5 / float
- TEXT
- NUMERIC : DATE, DATETIME
Create New Table :
create table users(id integer primary key autoincrement, name text, email text, password text);
INSERT DATA
- INSERT INTO users(nama, email, alamat) values('Madun','[email protected]','jakarta');
UPDATE DATA
- UPDATE users SET nama='Faisal' WHERE rowid = 1;
DELETE DATA
- DELETE FROM users WHERE id = 1;
SELECT DATA
- SELECT * FROM anggota;
Re-open Database :
- sqlite3 db_name.db
Desktop GUI for SQLite :
https://sqlitebrowser.org