H I O X INDIA
MySQL Tutorial
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Templates 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)
Español Français 中文 Deutsch
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

Mysql Tutorial
Introduction
How to Install
Database
Datatypes
Tables
INSERT
SELECT
UPDATE
DELETE
Operators
Functions
Ask Your Doubts
More about Mysql
Feedback




Inserting Multiple rows into a Mysql Database


Topic

How to insert multiple rows into a database table?



Explanation

INSERT STATEMENT FOR MULTIPLE ROWS :

    We can insert multiple rows into a table using a single INSERT statement.

The Syntax is

INSERT INTO tbl_name(col_name1, col_name2,...) VALUES(expr1, expr2,.....;), (expr1a, expr2a,.....;)

Example :

mysql> insert into student(studid,name,marks,address,phone) 
values(3,'michael',75,'edinburgh',2598234),
(4,'jack',82,'victoria street',2436821),
(5,'anne',100,'downing street',2634821);
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0 
    The above query will insert the three students details into the table student. This query will be useful while inserting large amount data into a specific table.






        MySQL is the most popular open source Relational database Management system (RDBMS). Being a open source anyone can use and change the software for their needs. Hope you enjoy this tutorial. We welcome your Valuable feedbacks or suggestions on this MySQL tutorial. This is a copyright content.


privacy policy     license     sitemap
© 2004-2009 HIOX INDIA - hioxindia.com

Other Links