How to insert data in MySQL?

To insert data into MySQL, you can use the INSERT INTO statement. Here’s an example:

INSERT INTO 表名 (列1, 列2, 列3)
VALUES (值1, 值2, 值3);

In this example, you need to replace “table name” with the name of the table where you want to insert data, “column1, column2, column3” with the names of the columns in the table, and “value1, value2, value3” with the data values to be inserted.

If you need to insert multiple lines of data, you can use the following syntax:

INSERT INTO 表名 (列1, 列2, 列3)
VALUES (值1, 值2, 值3),
       (值4, 值5, 值6),
       (值7, 值8, 值9);

This allows you to insert multiple rows of data at once. Keep in mind that the number and order of the values being inserted must match the number and order of the columns.

Leave a Reply 0

Your email address will not be published. Required fields are marked *