sqliteHow do I install and use SQLite on Ubuntu?
- Install SQLite on Ubuntu by running the command
sudo apt-get install sqlite3
in a terminal window. - Create a new database by running the command
sqlite3 <database_name>
in the same terminal window. - Create a table in the database by running the command
CREATE TABLE <table_name> (<column_name> <data_type>)
. - Add records to the table using the command
INSERT INTO <table_name> VALUES (<value1>, <value2>, ...)
. - Retrieve records from the table using the command
SELECT * FROM <table_name>
. - Update existing records using the command
UPDATE <table_name> SET <column_name> = <new_value> WHERE <column_name> = <value>
. - Delete records from the table using the command
DELETE FROM <table_name> WHERE <column_name> = <value>
.
Example code block:
sqlite> CREATE TABLE users (name TEXT, age INTEGER);
sqlite> INSERT INTO users VALUES ('John', 25);
sqlite> SELECT * FROM users;
name age
---------- ----------
John 25
Helpful links
More of Sqlite
- How do I use the SQLite ZIP VFS to compress a database?
- How do I use SQLite to retrieve data from a specific year?
- How can I use an upsert statement to update data in a SQLite database?
- How can SQLite and ZFS be used together for software development?
- How do I use SQLite KMM to create a database?
- How do I use variables in a SQLite database?
- How do I use SQLite transactions?
- How do I use SQLite to zip a file?
- How do I show the databases in SQLite?
See more codes...