Insert into statement
The insert into statement is used to INSERT new rows INTO the table.
Syntax
Insert into table name VALUES (value 1, value 2 ,....)
You can also specify the columns to insert data:
Insert into table_name (column 1, column 2,...) VALUES (value 1, value 2 ,....)
Insert a new row "Persons" table:
LastName |
FirstName |
Address |
City |
Carter |
Thomas |
Changan Street |
Beijing |
SQL statement:
INSERT INTO Persons VALUES ('Gates', 'Bill', 'Xuanwumen 10', 'Beijing')
Result:
LastName |
FirstName |
Address |
City |
Carter |
Thomas |
Changan Street |
Beijing |
Gates |
Bill |
Xuanwumen 10 |
Beijing |
Insert the data "Persons" table into the specified column:
LastName |
FirstName |
Address |
City |
Carter |
Thomas |
Changan Street |
Beijing |
Gates |
Bill |
Xuanwumen 10 |
Beijing |
SQL statement:
Insert into Persons (LastName, Address) VALUES ('wilson ', 'champs tutorial-elysees ')
Result:
LastName |
FirstName |
Address |
City |
Carter |
Thomas |
Changan Street |
Beijing |
Gates |
Bill |
Xuanwumen 10 |
Beijing |
Wilson |
|
Champs-Elysees |