sql语言中有没有类似C语言中的switch case的语句?? 没有,用case when 来代替就行了. 例如,下面的语句显示中文年月 select getdate() as 日期,case month(getdate()) when 11 then '十一' when 12 th...
分类:
数据库 时间:
2014-07-11 21:21:53
阅读次数:
247
最近遇到一个需要在多用户模式下重新命名数据库的Case, 因为数据库可能被其他用户使用,所以直接修改可能会失败。对于此种情况,我们可以等所有用户结束使用数据库时修改,或者是将数据库切换到单用户模式下进行操作。有时候,我们在开发过程中需要直接把生产环境的数据库拿到开发环境来测试开发。我们可以直接重命名...
分类:
数据库 时间:
2014-07-11 18:54:04
阅读次数:
254
--当A列大于B列时选择A列否则选择B列,当B列大于C列时选择B列否则选择C列。select (case when a>b then a else b end ), (case when b>c then b esle c end) from table_name--求...
分类:
数据库 时间:
2014-07-11 11:30:56
阅读次数:
208
-------------------------sql脚本---------------------------SELECT (CASE WHEN a.colorder=1 THEN d.name ELSE '''' END) N'表名', a.colorder N'字段序号', a.name N...
分类:
其他好文 时间:
2014-07-11 11:01:19
阅读次数:
208
BASH中的case结构,可以用于进行多项分支。case "$var" incondition1) ;;condition2) ;;*) default statments;;esac例如:#!/bin/bashecho "Hit a key, then hit return"read...
分类:
其他好文 时间:
2014-07-11 10:44:58
阅读次数:
230
这个例子出自《精通正则表达式》,做一下笔记帮助理解和记忆。第一版最简单的case就是考虑包含一对引号,那么写出来的表达式应该是这样的:".*"但是这个未免太简单了吧,会有啥问题呢?假如输入的字符串长这样结果就会出问题拉。see...Input String: "Hello" and "World" ...
分类:
其他好文 时间:
2014-07-11 09:16:39
阅读次数:
174
Notice:Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.For example:Input: ["tea","an....
分类:
其他好文 时间:
2014-07-10 14:44:00
阅读次数:
179
题意:
给定case数
给定n个点的树,m个询问
下面n-1行给出树边
m个询问 x y
问:以x为根,y子树下 y的最小点标的儿子节点 和子孙节点
思路:
用son[u][0] 表示u的最小儿子 son[u][2] 表示u的次小儿子
son[u][1] 表示u的最小子孙
若lca(x,y) !=y 则就是上述的答案
若lca(x,y) == y
1、y != 1 那么最...
分类:
其他好文 时间:
2014-07-09 13:05:35
阅读次数:
141
Who Gets the Most Candies?
Time Limit: 5000MS
Memory Limit: 131072K
Total Submissions: 9416
Accepted: 2868
Case Time Limit: 2000MS
Description
N children are s...
分类:
其他好文 时间:
2014-07-09 12:46:35
阅读次数:
234