Skip to content

Instantly share code, notes, and snippets.

@oksbwn
Last active March 7, 2023 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oksbwn/55f4590ae1a9b2805a1c3ea5dbcd5d0c to your computer and use it in GitHub Desktop.
Save oksbwn/55f4590ae1a9b2805a1c3ea5dbcd5d0c to your computer and use it in GitHub Desktop.
SQLite queries used in tutorial
  • Start REPL console. Use .quit anytime to exit.
$ sqlite3 test_db.db
  • List Tables
.tables
  • Create a Table

Check out supported types here

> CREATE TABLE sensors(id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255), value REAL, unit VARCHAR(100), timestamp DATETIME);
  • READ from a table
> SELECT * FROM sensors
  • INSERT data to a table
> INSERT INTO sensors (id, name, value, unit, timestamp) VALUES (null, 'SENSOR_1', 23.4, 'Volt',datetime("now"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment