Introduction: The INSERT INTO
statement is used to insert a new row in a table. Two ways to INSERT data into a
table one is to insert it one row at a time the other is to insert multiple rows
at a time. The SQL INSERT INTO syntax has two main forms and the result of
either of them is adding a new row into the database table. The second form of
the SQL INSERT INTO command specifies both the columns and the values to
be inserted. The Other way INSERT INTO allows us to insert multiple rows into a
table. Where we insert a single row by specifying its values for all columns we
now use a SELECT statement to specify the data that we want to insert into the
table. This method is used when table is already created in the database earlier
and data is to be inserted into this table from another table. If columns listed
in insert clause and select clause are same they are are not required to list
them.
- Two way to insert into used on a
table:
INSERT INTO
Table1
VALUES (value1, value2, value3…)
INSERT INTO
Table1 (Column1, Column2, Column3…)
VALUES (Value1, Value2, Value3…)
- Example:
INSERT INTO
Customers
VALUES ('Peter',
'Hunt', 'peter.hunt@tgmail.net', '1/1/1974', '626 888-8888')
Summary: Thai is the simple example that show how to insert the values on particular table. In this query we have simple insert the data on the Customers table.