H I O X INDIA
MySQL Tutorial
Google
Web hscripts.com
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Directories 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)   Bookmarks :-)  
 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
Feedback





Inserting row into a Table


Topic

How to insert data or add a row into a table?
How to use INSERT...SET to add a row?



Explanation

INSERT STATEMENT :

    INSERT statement 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)





others


        MySQL is the most popular open source database Management system. 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-2005 HIOX INDIA - hioxindia.com

Other Links