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 Row into a Mysql Database Table


Topic

How to insert data or add a new row into a database table?
How to use INSERT, SET queries to add a new row in a Mysql Database?



Explanation

INSERT STATEMENT :

    INSERT query is used for inserting new rows or data into an existing table.
The Insert syntax is

INSERT INTO tbl_name VALUES[(col_name,...)];

    If the datatype is not mentioned it will consider NULL values.

    The following example query will add the values like studid, name, marks, address and Phone number into the table student.

mysql> insert into student values(1, "steve", 100, "5th cross street", 2456987);
Query OK, 1 row affected (0.01 sec)


INSERT...SET STATEMENT :

    The INSERT...SET is also used to insert values the using the column name.
The syntax is

INSERT INTO tbl_name SET col_name = expr,.....;

    Lets take the same values inserting into the table student.

mysql> insert into student set studid=1, name='steve', marks=100, address='5th cross street', phone=2456987;
Query OK, 1 row affected (0.03 sec)








        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