SQL知识整理
一:Select语句:
select 字段名 from 表名 where 条件 order by 排序
see:select distinct 从多个相同字段中抓唯一值
see:查找ld_det_andy表中有数据但ld_det_temp表中没数据的数据
select * from ld_det_andy a where
(not exists (select * from ld_det_temp where ld_loc = a.ld_loc and ld_part = a.ld_part))
see:选出累计访问量最大的10个ip地址,并按访问量降序排列。
select top 10 ip, countip from
(select ip,count(*) as countip from records group by ip) a
order by countip desc
see:表student(id,name,score)根据分数列(score)每10分为一段,查询每段分数的人数
select ScoreRank,count(*) from
(select ScoreRank = case
when score >= 0 and score < 10 then '0-9'
when score >= 10 and score < 20 then '10-19'
when score >= 20 and score < 30 then '20-29'
when score >= 30 and score < 40 then '30-39'
when score >= 40 and score < 50 then '40-49'
when score >= 50 and score < 60 then '50-59'
when score >= 60 and score < 70 then '60-69'
when score >= 70 and score < 80 then '70-79'
when score >= 80 and score < 90 then '80-89'
&nb
相关文档:
下列语句部分是Mssql语句,不可以在access中使用。
SQL分类:
DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE)
DML—数据操纵语言(SELECT,DELETE,UPDATE,INSERT)
DCL—数据控制语言(GRANT,REVOKE,COMMIT,ROLLBACK)
首先,简要介绍基础语句:
1、说明:创建数据库
......
32
位的操作系统只能用
4G
的内存(不确定这句话是否正确),因为
2
的
32
次方是
4G
。默认的情况下,操作系统给自己留了
2G
,剩下的
2G
给应用程序。所以,每个应用程序所能使用的内存,最大不超过
2G
。据说可以改
WINDOWS
的
BOOT.INI
,强制操作系统只使用
1G
,即使这样,应用程序也至多是
......
发表下本人进行漏洞挖掘的首篇原创文章:
对Discuz nT3.0进行了分析,发现spacemanage.aspx页面存在一个注入漏洞,
该页面位置:dnt3_src\dnt3\Discuz.Web\space\Admin
代码如下:
public void BindData()
{
DataGrid1.AllowCustomPaging = true;
string username = Usernam ......
应一个朋友的要求,贴上收藏的SQL常用分页的办法~~
表中主键必须为标识列,[ID] int IDENTITY (1,1)
1.分页方案一:(利用Not In和SELECT TOP分页)
语句形式:
SELECT TOP 页记录数量 *
from 表名
WHERE (ID NOT IN
(SELECT TOP (每页行数*(页数-1)) ID
from 表名
ORDER BY ......
Suppose we have a recursive hierarchy stored in a relational database and we want to write it to XML. This might be for a variety of reasons – e.g. as a pre-cached input to a UI control, to export to another system using a pre-defined format, etc.
In SQL Server 2000, in order to ......