INSERTing data : Insert « Insert Update Delete « MySQL Tutorial






The basic syntax for the INSERT statement is as follows.

INSERT INTO <table_name>
VALUES (
value1,
value2,
etc......
);

The above format will work fine if you are inserting data into every field in a row.

If you only want to insert data into certain fields (columns) you will need to specify only these fields as part of the statement.

INSERT INTO <table_name> (
column1,
column2,
....
) VALUES (
value1,
value2,
....
);








7.1.Insert
7.1.1.INSERTing data
7.1.2.Insert more than one rows in a single insert statement
7.1.3.Insert two rows with one insert statement
7.1.4.Do calculation in the insert statement referencing the column name
7.1.5.Insert quotation marks
7.1.6.Insert NULL to a NOT NULL column
7.1.7.Insert with set statement
7.1.8.Use the DEFAULT in the insert statement
7.1.9.Using encode function with insert statement