In this article we will see "How to INSERT data INTO a Table in MySql" and "MySql INSERT INTO TABLE query syntax with example".

"INSERT INTO TABLE" query syntax

"INSERT INTO TABLE" is used to INSERT data INTO a Table in MySql, the syntax is as follow.


INSERT INTO tableName 
VALUES (value1, value2, value3, ...);

"INSERT INTO TABLE" query example

"INSERT INTO TABLE" is used to INSERT data INTO a Table in MySql, as shown in the example below.


/* Use database where the table is going to be INSERT INTOd*/
use testDatabase;

/* INSERT INTO table */
INSERT INTO testTable VALUES(1,'info@techburps.com','techburps');

/* SELECT data */
SELECT * from testTable;

Output: Output will be something like this:


+------+--------------------+-----------+
| id   | email              | name      |
+------+--------------------+-----------+
|    1 | info@techburps.com | techburps |
+------+--------------------+-----------+
1 rows in set (0.01 sec)


"INSERT INTO TABLE" for specified columns query syntax

"INSERT INTO TABLE" can be used to INSERT data INTO specified columns of a Table in MySql, the syntax is as follow.


INSERT INTO tableName (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);

"INSERT INTO TABLE" for specified columns query example

"INSERT INTO TABLE" can be used to INSERT data INTO specified columns of a Table in MySql, as shown in the example below.


/* Use database where the table is going to be INSERT INTOd*/
use testDatabase;

/* INSERT INTO table */
INSERT INTO testTable(id,name) VALUES(2,'techburps');

/* SELECT data */
SELECT * from testTable;

Output: Output will be something like this:


+------+--------------------+-----------+
| id   | email              | name      |
+------+--------------------+-----------+
|    1 | info@techburps.com | techburps |
|    2 | NULL               | techburps |
+------+--------------------+-----------+
2 rows in set (0.00 sec)

In this article we have seen "How to INSERT data INTO a Table in MySql", in upcoming articles we will see more about Mysql syntax and queries with example.
  • By Techburps.com
  • Oct 17, 2017
  • MySql