9951 explained code solutions for 126 technologies


sqliteHow can I quickly get started with SQLite?


To quickly get started with SQLite, follow these steps:

  1. Download and install the SQLite3 command line tool. It can be found here.

  2. Create a database file. This can be done with the following command:

sqlite3 mydatabase.db
  1. Create a table in the database. This can be done with the following command:
CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    username TEXT NOT NULL,
    email TEXT
);
  1. Insert some data into the table. This can be done with the following command:
INSERT INTO users (username, email) VALUES ('John', '[email protected]');
  1. Query the data from the table. This can be done with the following command:
SELECT * FROM users;

This will print out the following output:

1|John|[email protected]
  1. Close the database connection. This can be done with the following command:
.exit
  1. For more information on working with SQLite, check out the SQLite Tutorial.

Edit this code on GitHub