summaryrefslogtreecommitdiff
path: root/doc/note/sqlite/sqlite.txt
diff options
context:
space:
mode:
authorAndreas Fankhauser hiddenalpha.ch2024-09-30 18:49:24 +0200
committerAndreas Fankhauser hiddenalpha.ch2024-09-30 18:49:24 +0200
commit8abe4002c04c3e381d54ff57a2b7e2aaf551b7a3 (patch)
tree6f9c9e86f2731af3e5d414a16ae7e5d69aa0ceb8 /doc/note/sqlite/sqlite.txt
parent69782e8b126fdcd5b51e40773099c136e139a839 (diff)
parentcaf8fe34a85facf4edad8930015fbe9ae3d5f7b6 (diff)
downloadUnspecifiedGarbage-8abe4002c04c3e381d54ff57a2b7e2aaf551b7a3.zip
UnspecifiedGarbage-8abe4002c04c3e381d54ff57a2b7e2aaf551b7a3.tar.gz
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'doc/note/sqlite/sqlite.txt')
-rw-r--r--doc/note/sqlite/sqlite.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/note/sqlite/sqlite.txt b/doc/note/sqlite/sqlite.txt
index 3805e07..ddcc0ae 100644
--- a/doc/note/sqlite/sqlite.txt
+++ b/doc/note/sqlite/sqlite.txt
@@ -26,6 +26,13 @@ csv Example (no headrow):
sqlite3 foo.db -bail -cmd '.mode csv' -cmd '.separator ;' -cmd '.import foo.csv FooTable'
+## Insert conditional
+
+INSERT INTO table(id, text)
+SELECT 5, 'text to insert'
+WHERE NOT EXISTS (SELECT 1 FROM table WHERE id = 5)
+
+
## Drop Column
ALTER TABLE table DROP COLUMN column;
@@ -39,4 +46,5 @@ csv Example (no headrow):
## Refs
[drop column TODO vote](https://stackoverflow.com/a/66399224/4415884)
+[insert if not exists](https://stackoverflow.com/a/19337206/4415884)