diff --git a/README.md b/README.md index 6e64b4a..67e91c8 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,4 @@ - [Gitea Create Repo API: Curl POST](/gitea-create-repo-api-curl-post.md) - [Mount LUKS drive to Windows Subsystem for Linux Bare](/mount-luks-drive-to-windwos-subsystem-for-linux-bare.md) - [GOHUGO PWA SETUP](/gohugo-pwa-setup.md) +- [sqlite3 guide](/sqlite3-guide.md) diff --git a/sqlite3-guide.md b/sqlite3-guide.md new file mode 100644 index 0000000..32305b7 --- /dev/null +++ b/sqlite3-guide.md @@ -0,0 +1,47 @@ +# sqlite3 Guide + +## Create Table + +``` sql +CREATE TABLE IF NOT EXISTS config ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + user TEXT NOT NULL UNIQUE, + hashed_password TEXT NOT NULL +); +``` + +## Add Record to Table + +``` sql +INSERT INTO config (user, hashed_password) VALUES ('abc', 'base64 hashed password'); +``` + +## Update Record + +``` sql +UPDATE config SET user = 'def' WHERE user = 'abc'; +``` + +## Get All Records from Table + +``` sql +SELECT * FROM config; +``` + +## Get Specific Record Field based on User + +``` sql +SELECT hashed_password FROM config WHERE user = 'abc'; +``` + +## Delete Record + +``` sql +DELETE FROM config WHERE user = 'abc'; +``` + +## View All Tables + +``` sql +.tables +```