1. 程式人生 > >[6]SQL INSERT INTO

[6]SQL INSERT INTO

values .com value tac pre run alt name color

[6]SQL INSERT INTO

INSERT INTO 語句用於向表中插入新記錄。

下面是選自 "Websites" 表的數據:

+----+--------------+---------------------------+-------+---------+
| id | name         | url                       | alexa | country |
+----+--------------+---------------------------+-------+---------+
| 1  | Google       | https://www.google.cm/    | 1     | USA     |
| 2  | 淘寶          | https://www.taobao.com/   | 13    | CN      |
| 3  | 菜鳥教程      | http://www.runoob.com/    | 4689  | CN      |
| 4  | 微博          | http://weibo.com/         | 20    | CN      |
| 5  | Facebook     | https://www.facebook.com/ | 3     | USA     |
+----+--------------+---------------------------+-------+---------+

實例

INSERT INTO Websites (name, url, alexa, country)
VALUES (百度,https://www.baidu.com/,4,CN);

執行以上 SQL,再讀取 "Websites" 表,數據如下所示:

技術分享

實例

INSERT INTO Websites (name, url, country)
VALUES (stackoverflow, http://stackoverflow.com/, IND);

執行以上 SQL,再讀取 "Websites" 表,數據如下所示:

技術分享

[6]SQL INSERT INTO