- 浏览: 112630 次
- 性别:
- 来自: 青岛
文章分类
最新评论
-
gozen007:
...
Axis2 与 JAX-WS规范 -
vvnet:
时间长了,好像是沿用了“但是如果preparedStateme ...
oracle preparedStatement ResultSet.Type_Scroll_Insensitive 乱码 -
xdchenggong:
请问你的乱码问题解决了吗,我也遇到这问题了,找不到解决办法
oracle preparedStatement ResultSet.Type_Scroll_Insensitive 乱码 -
623deyingxiong:
补充一点:在Eclipse里,子类的方法名只要满足参数列表,方 ...
overload和override的区别 -
qq274035206:
很好 写的很详细
Eclipse下支持jQuery1.2.6
1、关于group by 表内容:
2005-05-09
胜
2005-05-09
胜
2005-05-09
负
2005-05-09
负
2005-05-10
胜
2005-05-10
负
2005-05-10
负
如果要生成下列结果,
该如何写sql
语句?
胜
负
2005-05-09
2
2
2005-05-10
1
2
答案:
1)
select
rq,sum
(case
when
shengfu=
'
胜
'
then
1
else
0
end
) as
胜
,sum
(case
when
shengfu=
'
负
'
then
1
else
0
end
) as
负
from
tab3 group
by
rq
2)
select
N.rq,N.
胜
,M.
负
from
(select
rq,count
(*)
胜
from
tab3 where
shengfu=
'
胜
'
group
by
rq)N inner
join
(select
rq,count
(*)
负
from
tab3 where
shengfu=
'
负
'
group
by
rq)M on
N.rq=M.rq
3)
select
a.rq,a.
胜
as
胜
,b.
负
as
负
from
(select
rq,count
(shengfu)
胜
from
tab3 where
shengfu=
'
胜
'
group
by
rq) a,
(select
rq,count
(shengfu)
负
from
tab3 where
shengfu=
'
负
'
group
by
rq) b
where
a.rq=b.rq;
1.
关于group by
表内容:
1)
select
rq,sum
(case
when
shengfu=
'
胜
'
then
1
else
0
end
) as
胜
,sum
(case
when
shengfu=
'
负
'
then
1
else
0
end
) as
负
from
tab3 group
by
rq
2.
表中有A B C
三列,
用SQL
语句实现:当A
列大于B
列时选择A
列否则选择B
列,当B
列大于C
列时选择B
列否则选择C
列。
3. 一个日期判断的sql 语句 请取出tab5
表中日期(SendTime
字段)
为当天的所有记录?(SendTime
字段为datetime
型,包含日
期与时间) 4.
有一张表,里面有3
个字段:语文,数学,英
语。其中有3
条记录分别表示语文70
分,数
学80
分,英语58
分,请用一条sql
语句查询出这三条记录并按以下条件显示出来(并写出您的思路):
------------------------------------------------------------------------------------------- ---------------------------------------------------------
6.
一个表中的Id
有多个记录,把所有这个id
的记录查出来,并显示共有多少条记录数。
select * from (select tab8,count (id) as num from tab8 group by id) t where t.num> 1 |
7. 用一条SQL 语句 查询出每门课都大于80 分的学生姓名
name kecheng fenshu
张三
语文
81
张三
数学
75
李四
语文
76
李四
数学
90
王
五
语文
81
王五
数学
100
王五
英语
90
a):
select
distinct
name
from
tab9
where
name
not
in
(select
distinct
name
from
tab9 where
fengshu<=
80
)
b):
select
* from
tab9 t7 where
t7.name
not
in
(select
t5.name
from
(select
* from
(select
t1.kecheng from
tab9 t1 group
by
t1.kecheng),(select
t2.name
from
tab9 t2 group
by
t2.name
)) t4,(select
* from
tab9) t5 where
t4.name
= t5.name
and
t4.kecheng = t5.kecheng
and
t5.fengshu <
80
)
8.
一个叫department
的表,里面只有一个字段name,
一
共有4
条纪录,分别是a,b,c,d,
对应
四个球对,现在四个球对进行比赛,用一条sql
语句显示所有可能的比赛组合.
select t.bh|| 'vs' ||t1.bh from tab10 t,tab10 t1 where t.bh<>t1.bh 这个是分主客场的
select t.bh|| 'vs' ||t1.bh from tab10 t,tab10 t1 where t.bh<>t1.bh and t.bh>t1.bh 这个是不分的
9.
怎
么把这样一个表儿
year month
amount
1991 1 1.1
1991 2 1.2
1991 3 1.3
1991
4 1.4
1992 1 2.1
1992 2 2.2
1992 3 2.3
1992
4 2.4
查成这样一个结果
year
m1 m2 m3 m4
1991 1.1 1.2 1.3 1.4
1992 2.1 2.2 2.3 2.4
a):
select
t.year
,
(select
a.amout from
tab11 a where
a.month
=
1
and
a.year
=t.year
) m1,
(select
b.amout from
tab11 b where
b.month
=
2
and
b.year
=t.year
) m2,
(select
c.amout from
tab11 c where
c.month
=
3
and
c.year
=t.year
) m3,
(select
d.amout from
tab11 d where
d.month
=
4
and
d.year
=t.year
) m4
from
tab11 t group
by
t.year
10.
拷贝表(
拷贝数据,
源表
名:a
目标表名:b)
SQL: insert into b(a, b, c) select d,e,f
from b;
create table test as select * from dept; -- 从已知表复制数据和结构
create table test as select * from dept where 1=2; -- 从已知表复制结构但不包括数据
11.
显示文章、提交人和最后回复时间
select
a.title,a.username,b.adddate from table a,(select max(adddate) adddate
from table where table.title=a.title) b
12.
日程安排提前五分钟提醒
13.
两张关联表,删除主表中已经在副表中没有的信息
delete
from
fubiao a where
a.fid not
in
(select
id
from
zhubiao)
14.
有两个表tab12
和tab13
,均有key
和value
两个字段,如果tab13
的key
在tab12
中也有,就把tab13
的value
换为tab12
中对应的value
update
tab13 set
value
=(select
value
from
tab12 where
tab12.key
=tab13.key
)
15.
原表:
courseid coursename score
-------------------------------------
1
java
70
2
oracle
90
3
xml
40
4
jsp
30
5
servlet
80
-------------------------------------
为了便于阅读,
查询此表后的结果显式如下(
及格分数为60):
courseid coursename score mark
---------------------------------------------------
1
java
70
pass
2
oracle
90
pass
3
xml
40
fail
4
jsp
30
fail
5
servlet
80
pass
---------------------------------------------------
select
t.courseid,t.coursename,t.score,(case
when
score>
60
then
'pass'
else
'fail'
end
) mark from
tab14 t
16.
表15
a1
a2
1
a
1
b
2
x
2
y
2
z
用select
能选成以
下结果吗?
1 ab
2 xyz
17.
题为
有两个表, t1, t2,
Table t1:
SELLER |
NON_SELLER
-----
-----
A
B
A
C
A
D
B
A
B
C
B
D
C
A
C
B
C
D
D
A
D
B
D
C
Table
t2:
SELLER |
BAL
------
--------
A
100
B
200
C
300
D
400
要求用SELECT
语句列出如下结果:------
如A
的SUM(BAL)
为B,C,D
的和,B
的SUM(BAL)
为A,C,D
的和.......
且用的方法不要增加数据库负担,
如
用临时表等
发表评论
-
inceptor-sdk-transwarp-6.1.0-SNAPSHOT.jar和weblogic中的antlr*.jar包冲突解决方法
2020-06-29 16:39 655inceptor-sdk-transwarp-6.1.0-S ... -
关于Oracle11gR2用EXP导出时报EXP-00011错误的解决方法
2014-01-16 15:56 730转自:http://www.360doc.com/cont ... -
Oracle Group By 默认排序文件
2013-11-19 16:00 1570问题描述: oracle 9i 下的Group By 后 ... -
ORA-04031案例一则
2013-10-25 11:43 1684ORA-04031案例一则 Oracle Trouble ... -
Oracle DBMS_JOB
2014-10-10 15:05 722--创建测试表create table AAHXL(ID ... -
ORA-00600: internal error code
2013-09-22 16:22 1662ORA-00600: internal error cod ... -
Orale分区索引
2013-04-09 14:00 694表可以按range、hash、lis ... -
在线重定义表(DBMS_REDEFINITION)
2013-04-08 15:42 4853在系统正在运行,外部有程序正在访问表的同时 ... -
ORA-14038 global partitioned index must be prefixed 分区索引
2013-03-13 17:02 2350CREATE INDEX INX_TEST_COMP1 ... -
Windows7(64位)安装Oracle10g
2013-03-11 15:03 8771.下载Oracle安装文件,我下载的是64位且能够在V ... -
essbase的乱码的问题
2013-01-25 00:49 967找到我的电脑右键属性——高级——环境变量,找到系统变量里的es ... -
exp 报错 PLS-00302-SET_NO_OUTLINES
2012-11-13 14:28 1551Subject: PLS-00302-SET_NO_OUTLI ... -
EXECUTE IMMEDIATE及Using (精辟啊)
2012-10-11 10:05 1238当我们碰到有一类存储名称和过程的参数上都相似时,可以使用e ... -
关于oracle字符集 国家字符集和数据库字符集
2012-10-09 22:32 2974在imp一个dmp文件的时候 ... -
Oracle OUI 中的安装目录配置文件
2012-06-04 13:56 850系统盘下: Oracle\Inventory\Contents ... -
ORACLE:按月累计问题的解决方法
2012-02-08 11:14 1406情况一: 表结构中没有累计的字段,我们需要展示一下累 ... -
ORACLE统计连续N天的记录
2010-12-23 20:25 2098第一步:排序 SELECT * FROM TABLE1 ORD ... -
Analyze table对Oracle性能的提升
2010-02-05 10:26 2663Analyze table对Oracle性能的提升 ... -
传统数据库和内存数据库
2008-12-24 11:47 1137TimesTen Oracle 的内存数据库 TimesTen ... -
Oracle内存参数调优技术详解
2008-12-24 10:48 1233内容 实例结构 oracle实 ...
相关推荐
oracle SQL查询工具oracle SQL查询工具oracle SQL查询工具oracle SQL查询工具oracle SQL查询工具oracle SQL查询工具oracle SQL查询工具oracle SQL查询工具oracle SQL查询工具oracle SQL查询工具oracle SQL查询工具...
Welcome to “Beginning SQL for Oracle Database 18C”! Thanks for picking up this book. It’s safe to say you’re interested in learning about Oracle database, as that’s what this book is about. Why ...
Oracle Sql语句转换成Mysql Sql语句java 源码,非常简单,只要给定源oracle sql语句地址,和生成目标文件地址运行即可。
ORACLE SQL性能优化系列 ORACLE SQL性能优化系列 ORACLE SQL性能优化系列
解决oracle sqldeveloper无法连接mysql、SQLServer问题,sqlDeveloper是ORACLE数据库开发工具,自带的是无法连接MS SQL Server以及mysql的,想连接的话需要第三方工具。 使用方法: 解压出来后将2个jar放入jlib...
精通Oracle SQL【第2版】ORACLE SQL高级编程【第二版】学习笔记
Oracle SQL Developer is a relatively new product included in the range of Oracle products. It was frst introduced to the world in September 2005, by its code name Project Raptor. Raptor is a name ...
Oracle SQL 内置函数大全 SQL中的单记录函数 给出整数,返回对应的字符 连接两个字符串 增加或减去月份 用于对查询到的结果进行排序输出
Oracle SQL Tuning with Oracle SQLTXPLAIN: Oracle Database 12c Edition by Stelios Charalambides English | 8 May 2017 | ISBN: 1484224353 | 408 Pages | PDF | 24.39 MB Learn through this practical guide ...
Oracle SQL 11G2 官方文档,包含4份,分别是PLSQL语言参考、PLSQL程序包与类型、Oracle SQL参考、SQL快速参考
Oracle Sql基础(beginning oracle sql中文版)
《Oracle SQL高级编程/数据库系列》的作者莫顿以精炼、风趣的语言揭开了Oracle SQL高级编程的神秘面纱。所涵盖的内容涉及SQL核心、SQL执行、分析函数、联结、测试与质量保证等,并提供大量实用性建议,且总结出...
OracleSQL的优化.pdf
第三章 ORACLE SQL 单行函数 第四章 从多表中查询数据 第五章 用组函数合计数据 第六章 子查询 第七章 操纵数据 第八章 创建和管理表 第九章 内置约束 第十章 创建视图 第十一章 其他数据库对象 第十二章 控制用户...
Oracle SQL*Plus Pocket Reference, 2nd Edition Copyright Oracle SQL*PlusPocket Reference Section 1.1. Introduction Section 1.2. Interacting with SQL*Plus Section 1.3. Selecting Data Section 1.4. ...
资深开发DBA对Oracle SQL编写规范的总结
oracle SQL语法大全!!!!介绍一些基本概念!!!及语法。。。
《精通Oracle SQL 第2版》PDF版本下载
OracleSQL必备参考OracleSQL必备参考OracleSQL必备参考OracleSQL必备参考
oraclesql判断值为空-Oracle-sqlserver的空值(null)判断.pdf