MySQL insert operation

MySQL insert operation :

When you need to write any data in a table you have to wite insert query in mysql.

Syntax :

insert into <table_name> (<column_name1>, <column_name2>....) values(<value1>, <value2>,......);

Example :

insert into employee(id, name, salary) values('101', 'Pradeep', 45000);

If you want to not specify column name then it’s sure that each column value must write.

Example :

insert into employee values('101', 'Pradeep', 45000); 

Here it is clear that you will not write all column value then arise an error.
Example :

insert into employee values('101');

The above query does not compile because MySQL engine not able to specify which column value query taken. But if you will write query with column name then it’s ok.

Example :

insert into employee(id) values('101');

In above query all remaining column value will insert null.