随笔分类 - 数据库
摘要:--获取交集,也就是获取重复的记录SELECT*FROMEmployeeintersectselect*fromEmployee;--获取工资最高的前三条记录select*from(selectrow_number()over(orderbyWagedesc)asrownumber,Name,WagefromEmployee)astempwhererownumber<=3----Oracle基本操作学习笔记------1、Oracle中NULL处理函数:nvl()和nvl2()--nvl(expr1,expr2):如果expr1=null,择则返回expr2,否则返回expr1--nvl
阅读全文
摘要:1//把下面显示文本保存到TablespaceStudy.txt文件中23SQL>spool'F:\app\Administrator\oradata\TablespaceStudy.txt';45//创建临时表空间67SQL>createtemporarytablespaceuser_temp891tempfile'F:\app\Administrator\oradata\user_temp.dbf'10112size50m12133autoextendon14154next50mmaxsize20480m16175extentmanagement
阅读全文
摘要:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;MySQLDriverCS是MySQL数据库的一个免费开源的.NET驱动程序,...
阅读全文
摘要:<!--设为主键--> alter table DataTest add primary key (Id);--删除主键DECLARE @Constraint_Name varchar (200)select @Constraint_Name = Name from dbo.sysobjects where Xtype = 'PK' and Parent_Obj = (select ...
阅读全文
摘要:表一 App表二 Screenshot下面语句的意思: 根据表Screenshot里面的外键AppId=App.Id 把 ScreenshotUrl值赋给App 表的Urlupdate App set Url=(select Screenshot.ScreenshotUrl from Screenshot where AppId=App.Id and Screenshot.No=0)
阅读全文
摘要:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--ALTERprocedure[dbo].[ProReviewScreenshot](@Numint=3,@Categoryvarchar(20))asdeclare@sqlvarchar(300)se...
阅读全文
摘要:Code Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->统计表中一列中各类型的人数而且每一个学院的统计结果用一行显示 学院 总人数 毕业人数 结业人数 人文学院 300 298 ...
阅读全文
摘要:统计表中一列中各类型的人数而且每一个学院的统计结果用一行显示
阅读全文
摘要:1.select into 和 insert into select 区别及用法 select * into destTbl from srcTbl insert into destTbl(fld1, fld2) select fld1, 5 from srcTbl 以上两句都是将 srcTbl 的数据插入到 destTbl,但两句又有区别的。 第一句(select into from)要...
阅读全文
摘要:1.内链接(inner join on) 结果集是返回两个表中符合条件的数据,而舍弃不符合条件的语句 select * from table1 inner join table2 on table1_id=table2_id where age>20 2.外连接 (1)左外连接(left outer join/left join) 返回所有的匹配行并从关键字join左边表中返回...
阅读全文
摘要:public DataTable GetList(string strWhere) { string sqlStr = "select dwmc , count(dwmc) as total,sum(case when jw_bzh='毕业' then 1 else 0 end) as biye , sum(case when jw_bzh='结业' then 1 el...
阅读全文