insert into multiple rows code example

Example 1: sql server insert multiple rows

INSERT INTO table_name (column_list)
VALUES
    (value_list_1),
    (value_list_2),
    ...
    (value_list_n);

Example 2: SQL Insert Multiple Rows

INSERT INTO StudentTable

( Rollo, Name, Class, Contact )

VALUES ( '1', 'Jonny', '10th', '9856245'  ),

( '2', 'Ronny', '12th', '5421545'  );

Example 3: insert multiple rows in sql.

INSERT INTO table (col1, col2, col3)
VALUES
	(row1_val1, row1_val2, row1_val3),
	(row2_val1, row2_val2, row2_val3),
	(row3_val1, row3_val2, row3_val3);

Example 4: impala insert multiple rows

[localhost:21000] > describe val_example;
Query: describe val_example
Query finished, fetching results ...
+-------+---------+---------+
| name  | type    | comment |
+-------+---------+---------+
| id    | int     |         |
| col_1 | boolean |         |
| col_2 | double  |         |
+-------+---------+---------+

[localhost:21000] > insert into val_example values (1,true,100.0);
Inserted 1 rows in 0.30s
[localhost:21000] > select * from val_example;
+----+-------+-------+
| id | col_1 | col_2 |
+----+-------+-------+
| 1  | true  | 100   |
+----+-------+-------+

[localhost:21000] > insert overwrite val_example values (10,false,pow(2,5)), (50,true,10/3);
Inserted 2 rows in 0.16s
[localhost:21000] > select * from val_example;
+----+-------+-------------------+
| id | col_1 | col_2             |
+----+-------+-------------------+
| 10 | false | 32                |
| 50 | true  | 3.333333333333333 |
+----+-------+-------------------+

Tags:

Sql Example