Previous | Home | Next |
This command is use to insert the data into database according to the define manner or the sequence in which the table column is define in which we are inserting the data.
In the below SQL query we have "aid" which is a "FOREIGN KEY" from its corresponding table "studinfo" and we haven't define Null value, so its column value needs to insert in each row value insertion.
Syntax
INSERT INTO Tablename(col1, col2, col3) VALUES(val1, val2, val3)
Example
INSERT INTO //insert values into studadr studadr(said, aid, blck, hno, street, locatn, state, country) //studadr is a tablename VALUES (413,110,'f',40,'jhilmil', 'south','pune','Australia'); //ordering order is given
Example
INSERT INTO //insert some values into studadr studadr (aid, blck, hno, street, locatn, state, country) //studadr is a tablename VALUES (112,'s',410, 'whashington','central','DC','America');
Note: In the above code we have skip "said" value ,which is AUTO_INCREMENT and PRIMARY KEY also. so the value we want to insert gives the column name along with its values
Example
INSERT INTO //insert some values into studadr studadr (aid, blck, hno, street, locatn, state) VALUES (112,'s',410,'whashington','central','DC','America');
Note: In the above code we have left the country name whose DEFALUT value "India" is given which will come automaticaly.
Previous | Home | Next |