Insert Into
用途: 在表中插入新行
语法:
插入一行数据:
Insert Into table_name Values(value1, value2,....)
插入一行数据在指定的字段上:
Insert Into table_name(column1, column2,...) Values(value1, value2,....)
例:“Persons”表中的原始数据:
LastName | FirstName | Address | City |
Pettersen | Kari | Storgt 20 | Stavanger |
运行下面的SQL插入一行数据:
Insert Into Persons Values ('Hetland', 'Camilla', 'Hagabakka 24', 'Sandnes') |
插入后”Persons”表中的数据为:
LastName | FirstName | Address | City |
Pettersen | Kari | Storgt 20 | Stavanger |
Hetland | Camilla | Hagabakka 24 | Sandnes |
运行下面的SQL插入一行数据在指定的字段上:
Insert Into Persons (LastName, Address) Values ('Rasmussen', 'Storgt 67') |
插入后”Persons”表中的数据为:
LastName | FirstName | Address | City |
Pettersen | Kari | Storgt 20 | Stavanger |
Hetland | Camilla | Hagabakka 24 | Sandnes |
Rasmussen | | Storgt 67 | |