SQL INSERT INTO 语句讲解

来源:网络时间:2017-03-07 14:02:31

  INSERT INTO 语句用于向表格中插入新的行:INSERT INTO 表名称 VALUES (值1, 值2,....)

  我们也可以指定所要插入数据的列:INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....)

  插入新的行

  "Persons" 表:


LastNameFirstNameAddressCity
CarterThomasChangan StreetBeijing

  SQL 语句:

  INSERT INTO Persons VALUES ('Gates', 'Bill', 'Xuanwumen 10', 'Beijing')

  结果:


LastNameFirstNameAddressCity
CarterThomasChangan StreetBeijing
GatesBillXuanwumen 10Beijing

  在指定的列中插入数据

  "Persons" 表:

LastNameFirstNameAddressCity
CarterThomasChangan StreetBeijing
GatesBillXuanwumen 10Beijing

  SQL 语句:

  INSERT INTO Persons (LastName, Address) VALUES ('Wilson', 'Champs-Elysees')

  结果:

LastNameFirstNameAddressCity
CarterThomasChangan StreetBeijing
GatesBillXuanwumen 10Beijing
Wilson

Champs-Elysees

文章内容来源于网络,不代表本站立场,若侵犯到您的权益,可联系我们删除。(本站为非盈利性质网站) 联系邮箱:9145908@qq.com