易截截图软件、单文件、免安装、纯绿色、仅160KB

sql语法

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


相关文档:

sql连接(内连接、外连接、全连接)

现有table_for_report_1和table_for_report_2,详情如下:
table_for_report_1有num字段,c1,c2,c3字段。
数据如下:
    num                c1  c2  c3
1 15001346690 11 12 13
2 1 ......

SQL中处理时间问题案例

1. 获取数据库中当前月份的相关数据
SELECT WorkerSortID, SUM(WorkerCount) AS WorkerMothCount
from WorkerRecord
WHERE (YEAR(WorkerTime) = YEAR({ fn NOW() })) AND (MONTH(WorkerTime)
      = MONTH({ fn NOW() })) AND (WorkerCount > 0) AND (WorkerID = 'wy')
GROUP BY Worker ......

SQL Server 索引结构及其使用(四)[转]

SQL Server 索引结构及其使用(四)
作者:freedk
一、深入浅出理解索引结构
二、改善SQL语句
三、实现小数据量和海量数据的通用分页显示存储过程
聚集索引的重要性和如何选择聚集索引
  在上一节的标题中,笔者写的是:实现小数据量和海量数据的通用分页显示存储过程。这是因为在将本存储过程应用于“办 ......

通过SQL存储过程删除过期的数据库Bak备份文件

1.先启用 xp_cmdshell 扩展存储过程:
Use Master
GO
Exec sp_configure 'show advanced options', 1
GO
Reconfigure;
GO
sp_configure 'xp_cmdshell', 1
GO
Reconfigure;
GO
 (注:因为xp_cmdshell是高级选项,所以这里启动xp_cmdshell,需要先将 show advanced ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号