当前位置: 首页 > 网络学院 > 服务端脚本教程 > SQL > SQL Insert

SQL
SQL 介绍
SQL Select
SQL Where 子句
SQL Insert
SQL Update
SQL Delete
SQL 技能测试
SQL Order By
SQL 与 & OR
SQL In
SQL Between
SQL Aliases
SQL Join
SQL Union
SQL Create
SQL Drop
SQL Alter
SQL 函数
SQL Group By
SQL Select Into

SQL Insert


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 1026 ::
收藏到网摘: n/a

The INSERT INTO Statement
INSERT INTO声明

The INSERT INTO statement is used to insert new rows into a table.
INSERT INTO 声明可以向数据表插入新的数据行

语法

INSERT INTO table_name
VALUES (value1, value2,....)

You can also specify the columns for which you want to insert data:
你也可以给指定栏目插入指定的数据:

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


Insert a New Row
插入新的一行记录

“Persons”表:

LastName FirstName Address City
Pettersen Kari Storgt 20 Stavanger

SQL语句:

INSERT INTO Persons 
VALUES ('Hetland', 'Camilla', 'Hagabakka 24', 'Sandnes')

得到结果为:

LastName FirstName Address City
Pettersen Kari Storgt 20 Stavanger
Hetland Camilla Hagabakka 24 Sandnes


Insert Data in Specified Columns
给指定的栏目加入数据

“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')

得到结果为:

LastName FirstName Address City
Pettersen Kari Storgt 20 Stavanger
Hetland Camilla Hagabakka 24 Sandnes
Rasmussen   Storgt 67  

评论 (0) All

登陆 | 还没注册?