Portal Home > Knowledgebase > Scripting, Component & Database > MySQL > How to insert data into a database table?
The following INSERT INTO statement is used to add new records to a database table.
Syntax 1:
It is possible to write the INSERT INTO statement in two forms. The first form doesn't specify the column names where the data will be inserted, only their values:
INSERT INTO table_name
VALUES ('value1', 'value2', 'value3');
Syntax 2:
The second form specifies both the column names and the values to be inserted:
INSERT INTO table_name (column1, column2, column3)
VALUES ('value1', 'value2', 'value3');
Add to Favourites
Print this Article