# `INSERT` Statement

__*INSERT syntax*__
__*INSERT IGNORE*__

+ The **`INSERT`** statement is used to add a single or multiple rows of data to an existing table
  + The number of columns in **`{column_list}`** and the number of values in **`{values_list}`** must be the same
  + The order of the values must match the order of the columns in the statement
  + Enclose column values of string and time data types (recommended) in single quotes
  + Numerical data does not need quotation marks
+ Use the **`IGNORE`** keyword to suppress the primary key or unique key conflicts error 

```
~!@// Syntax@!~
INSERT INTO table_name ({column_list}) VALUES ({value_list}) [,({value_list}),...];

~!@// Example@!~
tidb> CREATE TABLE store.stock (stock_id INT PRIMARY KEY, item VARCHAR(20), amount DECIMAL);
Query OK, 0 rows affected (0.61 sec)

tidb> INSERT INTO store.stock VALUES(1, 'apples', 15);
Query OK, 1 row affected (0.01 sec)

tidb> INSERT INTO store.stock VALUES(1, 'oranges', 18);
~!@ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'@!~
tidb> INSERT ~!@IGNORE@!~ INTO store.stock VALUES(1, 'oranges', 18);
Query OK, 0 rows affected, ~!@1 warning@!~ (0.00 sec)

tidb> SELECT * FROM store.stock;
+----------+--------+--------+
| stock_id | item   | amount |
+----------+--------+--------+
|        ~!@1@!~ | apples |     15 |
+----------+--------+--------+
1 row in set (0.00 sec)
```

------------------------------------------------------------

The `INSERT` statement is used to add a single or multiple rows of data to an existing table.

When you try to insert data that conflicts with the primary key or a unique key of existing rows this will result in an error unless the `IGNORE` keyword is used.