在這一頁中,我們列出所有在這個網站有列出 SQL 指令的語法。若要更詳盡的說明,請點選 指令名稱。

這一頁的目的是提供一個簡潔的 SQL 語法做為讀者參考之用。我們建議您現在就按 Control-D 將本 頁加入您的『我的最愛』。

Select
SELECT "欄位" FROM "表格名";

Distinct
SELECT DISTINCT "欄位"
FROM "表格名";

Where
SELECT "欄位"
FROM "表格名"
WHERE "condition";

And/Or
SELECT "欄位"
FROM "表格名"
WHERE "簡單條件"
{[AND|OR] "簡單條件"}+ ;

In
SELECT "欄位"
FROM "表格名"
WHERE "欄位" IN ('值1', '值2', ...);

Between
SELECT "欄位"
FROM "表格名"
WHERE "欄位" BETWEEN '值1' AND '值2';

Like
SELECT "欄位"
FROM "表格名"
WHERE "欄位" LIKE {模式};

Order By
SELECT "欄位"
FROM "表格名"
[WHERE "條件"]
ORDER BY "欄位" [ASC, DESC];

Count
SELECT COUNT("欄位")
FROM "表格名";

Group By
SELECT "欄位1", SUM("欄位2")
FROM "表格名"
GROUP BY "欄位1";

Having
SELECT "欄位1", SUM("欄位2")
FROM "表格名"
GROUP BY "欄位1"
HAVING (函數條件);

Create Table
CREATE TABLE "表格名"
("欄位 1" "欄位 1 資料種類",
"欄位 2" "欄位 2 資料種類"",
... );

Drop Table
DROP TABLE "表格名";

Truncate Table
TRUNCATE TABLE "表格名";

Insert Into
INSERT INTO "表格名" ("欄位1", "欄位2", ...)
VALUES ("值1", "值2", ...);

Update
UPDATE "表格名"
SET "欄位1" = [新值]
WHERE "條件";

Delete From
DELETE FROM "表格名"
WHERE "條件";





Copyright © 2017   1keydata.com   版權所有