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

INSERT dataset.Inventory (product, quantity)
VALUES('top load washer', 10);

Insert multiple rows at once

INSERT dataset.Inventory (product, quantity)
VALUES('top load washer', 10),
      ('front load washer', 20),
      ('dryer', 30),
      ('refrigerator', 10),
      ('microwave', 20),
      ('dishwasher', 30),
      ('oven', 5)

Explanation

The INSERT statement above, results in

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
 [(column_1 [, ..., column_n ] )]
 input

input ::=
 VALUES (expr_1 [, ..., expr_n ] )
        [, ..., (expr_k_1 [, ..., expr_k_n ] ) ]
| SELECT_QUERY

expr ::= value_expression