mysql insert into
时间: 2023-10-06 07:14:07 浏览: 81
MySQL replace into 语句浅析(一)
5星 · 资源好评率100%
The INSERT INTO statement is used to add new records to a MySQL database table.
The basic syntax of the INSERT INTO statement is as follows:
```
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
```
Here, `table_name` is the name of the table to which you want to add data, and `column1`, `column2`, `column3`, etc. are the names of the columns in the table. `value1`, `value2`, `value3`, etc. are the values that you want to insert into those columns.
For example, if you have a table named `customers` with columns `customer_id`, `customer_name`, `customer_email`, and `customer_phone`, you can insert a new record into the table using the following statement:
```
INSERT INTO customers (customer_name, customer_email, customer_phone)
VALUES ('John Smith', 'john@example.com', '555-1234');
```
This statement will insert a new record into the `customers` table with the values 'John Smith' for the `customer_name` column, 'john@example.com' for the `customer_email` column, and '555-1234' for the `customer_phone` column. The `customer_id` column will be automatically generated by the database system.
阅读全文