首页 » 建站技术 » 浏览内容

SQL语句教程(35) SQL语法


2006-12-01 14:26:50 10,907 1 发表评论 字体: 作者:C.K.
标签: sql语句

体验版 88 元,个人版 128 元,多用户版 288元个人版160元升级到多用户版。

在这一页中,我们列出所有在这个网站有列出 SQL 指令的语法。若要更详尽的说明,请点选指令名称。

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 {条件}

    网站统计 Statistics

    • 创建时间: 2005年1月3日 距今4921 天
    • 日志总数: 2461
    • 评论总数: 630
    • 标签总数: 654
    • 链接总数: 273
    • 最后更新: 2017-7-1 18:16:33
    • 您是本站第 13646593 位访客

    广告区 Guǎng Gào