Home > Database > Mysql Tutorial > How do we insert new rows into a MySQL table?

How do we insert new rows into a MySQL table?

王林
Release: 2023-09-06 08:29:02
forward
1166 people have browsed it

我们如何向 MySQL 表中插入新行?

New rows can be inserted into the table with the help of the INSERT INTO command.

Syntax

INSERT INTO table_name values(value1,value2,…)
Copy after login

Example

Suppose we have a table named "Employee" which contains three columns "Emp_id", "Emp_name" and "Emp_Sal", then With the help of the following query we can add new rows to the table -

mysql> INSERT INTO Employee values(110,'Aarav',50000);
Query OK, 1 row affected (0.07 sec)

mysql> INSERT INTO Employee values(200,'Raman',28000);
Query OK, 1 row affected (0.10 sec)

mysql> Select * from Employee;
+---------+-------------+-----------+
| Emp_id  | Emp_name    | Emp_sal   |
+---------+-------------+-----------+
| 110     |Aarav        | 50000     |
| 200     | Raman       | 28000     |
+---------+-------------+-----------+
2 rows in set (0.00 sec)
Copy after login

The above is the detailed content of How do we insert new rows into a MySQL table?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The 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.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template