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
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 loginParameters:
<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
andINSERT INTO employees (id, name, email) VALUES (1, 'John Doe', 'john.doe@company.com');Copy after loginNote:
- The order of the inserted values must be consistent with the order of the columns in
<Column Name>
.- If
<column name>
is not specified, the value will be inserted into all columns in the table.- If you want to insert a
Rows can be inserted multiple times using theNULL
value, you need to specify # in the value ##NULL.
- VALUES()
clause, as shown below:
INSERT INTO employees (id, name, email) VALUES (2, 'Jane Doe', 'jane.doe@company.com'), (3, 'John Smith', 'john.smith@company.com');Copy after loginThe above is the detailed content of How to write mysql add data statement. For more information, please follow other related articles on the PHP Chinese website!
Related labels:Previous article:How to open mysql database with cmd command Next article:How to install mysql after downloading itStatement of this WebsiteThe content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cnLatest Articles by Author
2025-03-12 12:12:02 2025-03-05 20:30:01 2025-03-05 20:27:01 2025-03-05 20:24:01 2025-03-05 20:21:01 2025-03-05 20:18:01 2025-03-05 20:15:01 2025-03-05 20:06:02 2025-03-05 20:03:01 2025-03-05 20:00:02Latest Issues
2025-03-26 22:07:34 2025-03-26 22:06:43 2025-03-26 22:05:18 2025-03-26 22:03:46 2025-03-26 22:01:53Related TopicsMore>Popular RecommendationsPopular TutorialsMore>
![]()
![]()
JAVA Beginner's Video Tutorial2688033![]()
Latest DownloadsMore>