
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can we insert a new row into a MySQL table?
With the help of INSERT INTO command, a new row can be inserted into a table.
Syntax
INSERT INTO table_name values(value1,value2,…)
Example
Suppose we have a table named ‘Employee’ with three columns ‘Emp_id’, ‘Emp_name’ and ‘Emp_Sal’ then with the help of 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)
- Related Articles
- How can we insert data into a MySQL table?
- How can we use INSERT() function to insert a new string into the value of a column of MySQL table?
- How to insert new row into table at a certain index using jQuery?
- MySQL trigger to insert row into another table?
- How would you insert a new user into a MySQL table from within Laravel?
- How can we delete a single row from a MySQL table?
- How can we insert values into a table with the help of MySQL self-computed output?
- Insert JSON into a MySQL table?
- How can we insert data into an existing MySQL table by using PHP script?
- How can we fetch a particular row as output from a MySQL table?
- How can we insert current date automatically in a column of MySQL table?
- Can we insert records in a MySQL table without auto_increment values?
- MySQL INSERT INTO SELECT into a table with AUTO_INCREMENT
- How can we add values into the columns of a MySQL table?
- How can we set up a MySQL User account by using INSERT INTO statement?

Advertisements