Syntax for inserting new rows in table using pair-wise format?

Viewed 21

I have new empty table, that I run a loop from a program to populate the table.

The only syntax I know about to create new rows is the standard one given by

INSERT INTO table (column1,column2 ,..) VALUES( value1, value2 ,...);

The only issue is it become hard to match the correct column with its value when there are many fields/columns (20 or 30) in each row.

Does there exist a syntax that allows something as the following (I am making this up just to give an example, as this does not work)

INSERT INTO table (  column1=value1, column2=value2 ,..);

This will make it easier to see the correspondence between the field name and its value in the code and reduce chance of making mistake, instead of having them be separated as in the standard command.

I googled and searched but could not find anything so far.

Using sqlite3 on Linux.

1 Answers

Everything allowed is documented here. If you deal with SQL directly, you are out of luck. If you talk to SQLite programmatically via the library API, you could use parametrized queries with named parameters. For example, it is really easy to talk to SQLite from Python, which might simplify your tasks.

Related