SQL INSERT INTO 語句

NO IMAGE
1 Star2 Stars3 Stars4 Stars5 Stars 給文章打分!
Loading...

INSERT INTO 語句

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 


(adsbygoogle = window.adsbygoogle || []).push({});

function googleAdJSAtOnload() {
var element = document.createElement(“script”);
element.src = “//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”;
element.async = true;
document.body.appendChild(element);
}
if (window.addEventListener) {
window.addEventListener(“load”, googleAdJSAtOnload, false);
} else if (window.attachEvent) {
window.attachEvent(“onload”, googleAdJSAtOnload);
} else {
window.onload = googleAdJSAtOnload;
}

資料庫 最新文章