by homami · 6y ago · 0 comments
INSERT INTO "my_table"
"col1": value1,
"col2": value2,
...insert into Permissions(UserId, Create, Read, Update, Delete, Share, ForceUnlock, LaunchNukes) values (12345, 1, 1, 0, 1, 0, 0, 1);
When I wrote my (now unmaintained) statically typed SQL dialect for F#, which compiles to underlying SQLite/Postgres/MSSQL, I added a single-row insert with Field=Value because it's nice to have and took no more than 30 minutes to do. It's only a tweak to the parser after all -- you just parse it to the same AST used to represent the `INSERT ... VALUES` clause and all later stages of the compilation do not need to know about it.
https://rspeele.gitbooks.io/rezoom-sql/doc/Language/InsertSt...
INSERT INTO tbl WITH AUTO NAME
SELECT 'foo' AS name, 1 AS en1, 0 AS en2;
Not nearly as neat as the direct key=value syntax but... INSERT INTO tbl SET a = 1, b = 2;