oracle数据库根据不同条件给同一字段修改相应的值: 例如:根据职务调整雇员的工资,如果职务为“SALESMAN”或者“ANALYST”工资上调100元,如果职务为“MANAGER”工资上调200元,其它职务工资上调50元. update emp set sal=( case when job in('SALESMAN','ANALYST') then sal+100 when job = 'MANAGER' then sal+200 else sal+50 end ); 查询出当前的orac
sql SELECT COUNT(字段),分组字段,SUM(字段),SUM(字段) FROM 表 GROUP BY 分组字段 java EntityWrapper<ProjectEntity> pp= new EntityWrapper<ProjectEntity>(); pp.eq("depcode", community); int proc = projectService.selectCount(pp); pp.setSqlSelect("CO
update (select length(t.name), t.* -- name,length(name) from g_enterprise_info t where nvl2(translate(name, '\1234567890 ', '\'), 'is characters ', 'is number ') = 'is number ' and asciistr(gszcdjh) like '%\%') set name = gszcdjh, gszcdjh =name ; 判断一
select soct.Captcha,CreateOn,* from SceneryOrderCheckTicket soctright join (SELECT Captcha,convert(char(10),CreateOn,120) as createdate FROM dbo.SceneryOrderCheckTicket where CreateOn>'2014-01-01' and Ord in(1,2,3,4)group by Captcha,convert(char(10),
with tt as (select A.GID, CASE WHEN A.IsApp='是' THEN 'APP' else '' end 'APP', CASE WHEN A.IsSmallApp='是' THEN '小程序' else '' end 'SmallApp' from Order A ) select A.SalePrice,A.SaleStatus, --销售参与渠道 --(A.IsApp+','+A.IsSmallApp), --CASE WHEN A.IsApp='是'
将'0654879'替换成'0754879' UPDATE dbo.SG_Functionality SET FunctionalityCode=REPLACE(FunctionalityCode,'06','07') WHERE Type=2 AND FunctionalityCode LIKE '06%'
例如student表: studentID studentName studentScore 01 Alice 90 02 Bill 95 03 Cindy 100 一.拼接多个字段的值 select studentID+‘-’+studentName+'-'+studentScore AS studentInfo from student 结果: 二.一个字段多条记录的拼接 select stuff((select '|'+studentName from student for xm
转:http://www.cnblogs.com/pangpanghuan/p/6432331.html Sql Server 增加字段.修改字段.修改类型.修改默认值 1.修改字段名: alter table 表名 rename column A to B 2.修改字段类型: alter table 表名 alter column 字段名 type not null 3.修改字段默认值 alter table 表名 add default (0) for 字段名 with values 如果字
如student表: studentID studentName studentScore 01 Alice 90 02 Bill 95 03 Cindy 100 一.拼接多个字段的值 select studentID+‘-’+studentName+'-'+studentScore AS studentInfo from student 结果: 二.一个字段多条记录的拼接 select stuff((select '|'+studentName from student for xml p
select * from [dbo].[Sys_MemberKey] a where exists(select * from [Sys_MemberKey] b where a.FMachineCode<>'' and a.FKeyID=b.FKeyID and a.FMemberID<>b.FMemberID) 一个相同的表根据一个字段,查找另外一个字段不相同值,经测试可用
用SQL语句添加删除修改字段 1.增加字段 alter table docdsp add dspcode char(200)2.删除字段 ALTER TABLE table_NAME DROP COLUMN column_NAME3.修改字段类型 ALTER TABLE table_name ALTER COLUMN column_name new_data_type24.创建数据库 CREATE DATABASE database-name 25.
用SQL语句添加删除修改字段1.增加字段 alter table docdsp add dspcodechar(200)2.删除字段 ALTER TABLE table_NAME DROP COLUMNcolumn_NAME3.修改字段类型 ALTER TABLE table_name ALTER COLUMNcolumn_name new_data_type4.sp_rename 改名 更改当前数据库中用户创建对象(如表.列或用户定义数据类型)的名称.
用SQL语句添加删除修改字段1.增加字段 alter table docdsp add dspcodechar(200)2.删除字段 ALTER TABLE table_NAME DROP COLUMNcolumn_NAME3.修改字段类型 ALTER TABLE table_name ALTER COLUMNcolumn_name new_data_type4.sp_rename 改名 更改当前数据库中用户创建对象(如表.列或用户定义数据类型)的名称.