网站导航网学 原创论文 原创专题 网站设计 最新系统 原创论文 论文降重 发表论文 论文发表 UI设计定制 论文答辩PPT格式排版 期刊发表 论文专题
返回网学首页
网学原创论文
最新论文 推荐专题 热门论文 论文专题
当前位置: 网学 > 设计资源 > 数据库 > 正文

项目中常用sql语句

论文降重修改服务、格式排版等 获取论文 论文降重及排版 论文发表 相关服务

1:随机取出数据表中数据

select top n * from table order by newid()

2:取出插入表中的最新ID

insert into table vlues() select @@identity

3:取出表中10-20的数据

select top 10 * from table where id not in(select top 20 id from table)

4:判断字段并赋于不同值

select columnName1=

case columnName1

when 1 then 'value'

end

from table

5:获取最后更新时间的所有列

select  max(addDate) ,userName from table group by userName order by addDate desc

6:删除表中所有重复记录

delete from table where columnName =(select columnName from table group by columnName

having count(*)>1)

7:获取日期和时间

select  convert(char(20),getDate(),20) value from table
select  convert(char(8),getDate(),108) value from table

设为首页 | 加入收藏 | 网学首页 | 原创论文 | 计算机原创
版权所有 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
Copyright 2008-2020 myeducs.Cn www.myeducs.Cn All Rights Reserved 湘ICP备09003080号 常年法律顾问:王律师