Home > Database > Mysql Tutorial > How to write mysql add data statement

How to write mysql add data statement

下次还敢
Release: 2024-04-05 18:00:23
Original
1276 people have browsed it

MySQL uses the INSERT statement to insert data into the table. The syntax is: INSERT INTO

( <column name>, ... ) VALUES ( , ... ). Parameters include:
: the name of the table into which data is to be inserted; <column name>: the name of the column into which data is to be inserted; : the value in the column to be inserted. For example, to insert a row of data into a table named employees: INSERT INTO employees (id, name, email) VALUES (1, 'John Doe

How to write mysql add data statement

MySQL Add Data Statement

The statement used to insert data into the table in MySQL is the INSERT statement.

Syntax:

INSERT INTO <表名> ( <列名>, ... ) VALUES ( <值>, ... );
Copy after login

Parameters:

  • <Table Name>: The name of the table into which data is to be inserted.
  • <Column name>: The name of the column to be inserted into, which can be a single column or multiple columns.
  • <Value>: To insert the value in the column, it can be a single value or multiple values.

Usage example:

Suppose we have a class named employees table, which contains three columns: id, name and email. The following statement will insert a row of data into the table:

INSERT INTO employees (id, name, email) VALUES (1, 'John Doe', 'john.doe@company.com');
Copy after login

Note: