Home » Bigquery » Tutorials » INSERT values

BigQuery INSERT into table values

Use the INSERT statement when you want to add new rows to a table.

INSERT values example

\nINSERT dataset.Inventory (product, quantity)\nVALUES('top load washer', 10);\n
\n

Insert multiple rows at once

\n
\nINSERT dataset.Inventory (product, quantity)\nVALUES('top load washer', 10),\n      ('front load washer', 20),\n      ('dryer', 30),\n      ('refrigerator', 10),\n      ('microwave', 20),\n      ('dishwasher', 30),\n      ('oven', 5)\n

Explanation

The INSERT statement above, results in

\n\n\n\n\n\n\n\n\n\n\n
product quantity supply_constrained
dishwasher 30 NULL
dryer 30 NULL
front load washer 20 NULL
microwave 20 NULL
oven 5 NULL
refrigerator 10 NULL
top load washer 10 NULL

Syntax reference

INSERT [INTO] target_name\n [(column_1 [, ..., column_n ] )]\n input\n\ninput ::=\n VALUES (expr_1 [, ..., expr_n ] )\n        [, ..., (expr_k_1 [, ..., expr_k_n ] ) ]\n| SELECT_QUERY\n\nexpr ::= value_expression