sql
共 5 篇文章
case then sql
<!--StartFragment --> 得到<!--StartFragment --> 的sql select t.date,sum(case when t.score='胜' then 1 else 0 end) 胜,sum(case when t.score='败' then 1 else 0 end) 败 from test t group by t.shijain;
2011-08-05 17:51 · sql
oracle解除锁定
select username,sid,serial#,status,machine from v$session; alter system kill session '46,48586' alter system kill session '46,48586'
2011-06-30 12:58 · sql
Oracl 常用字符串函数
字符型变量存储的最大值: VARCHAR2数值被限制为2000字符(ORACLE 8中为4000字符) CHAR数值被限制为255字符(在ORACLE8中是2000) long类型为2GB Clob类型为4GB 1、CHR 语法: chr(x) 功能:返回在数据库字符集中与X拥有等价数值的字符。CHR和ASCII是一对反函数。经过CHR转换后的字符再经过ASCII转换又得到了原来的字 符。 使用位置:过程性语句和SQL语句。 2、CONCAT 语法: CONCAT(string1,string2) 功能:返回string1,并且在后面连接string2。 使用位置:过程性语句和SQL语句。 …
2011-03-30 11:45 · sql
orcal 日期查询设置
一、 常用日期数据格式 1.Y或YY或YYY 年的最后一位,两位或三位 SQL> Select to_char(sysdate,'Y') from dual; TO_CHAR(SYSDATE,'Y') 7 SQL> Select to_char(sysdate,'YY') from dual; TO_CHAR(SYSDATE,'YY') 07 SQL> Select to_char(sysdate,'YYY') from dual; TO_CHAR(SYSDATE,'YYY') 007 2.Q 季度 1~3月为第一季度,3表示第三季度。 SQL> Select to_char(sysdate…
2010-12-28 14:21 · sql
mySql常用实例
drop table if exists link_tb; commit; create table if not exists link_tb( id int unsigned not null auto_increment, name varchar(20), link varchar(255), detail varchar(150), primary key(id) ); commit; drop table if exists admin_tb; commit; create table if not exists admin_tb( id int unsigned not nul…
2010-11-17 09:00 · sql