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