MySQL Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Mysql Tutorial
Introduction
How to Install
Database
Datatypes
Tables
INSERT
SELECT
UPDATE
DELETE
Operators
Functions
Ask Your Doubts
Feedback
 





Insert Row into MySQL


Tutorials Mysql

Topic
How to Add or Insert Row into MySQL database table using INSERT query?


Explanation :

INSERT STATEMENT :

    INSERT query is used for insert a new row 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 insert statement 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)


    This is an example for simple insert query.

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)


    This is an example for insert row into mysql table with INSERT ...SET Satement.we can use these insert statement to add a row into tables.





A Note

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.


Other Links

web hosting