ORACLE数据库:表A 部门表 :字段:dept_id(部门ID) pid(上级单位ID) dept_name(部门名

透明宝2022-10-04 11:39:541条回答

ORACLE数据库:表A 部门表 :字段:dept_id(部门ID) pid(上级单位ID) dept_name(部门名称) dept_type
ORACLE数据库:
表A 部门表 :字段:dept_id(部门ID) pid(上级单位ID) dept_name(部门名称) dept_type(部门类型 0:部门,1:单位,就是上级单位)
表B 人员表:字段:user_id dept_id(所属部门ID)
表C 住房表:字段:building_id user_id lh_id(楼号ID)
表D 楼号表:字段:lh_id lh_type(楼的类型a 0:老城,1:新城) lh_kind(楼的类型B 0:多层,1:高层)
需要的结果:
单位 部门 新城多层 新城高层 老城多层 老城高层 小计
单位A 部门A 5 10 40 20 75
单位B.

已提交,审核后显示!提交回复

共1条回复
丛林精灵 共回答了16个问题 | 采纳率100%
select t11.organ_name "单位",
t11.dept_name "部门",
count(case when t14.lh_type=1 and t14.lh_kind=0 then 1 else null end) "新城多层",
count(case when t14.lh_type=1 and t14.lh_kind=1 then 1 else null end) "新城高层",
count(case when t14.lh_type=0 and t14.lh_kind=0 then 1 else null end) "老城多层",
count(case when t14.lh_type=0 and t14.lh_kind=1 then 1 else null end) "老城高层",
count(1) "小计"
from (select t1.dept_name organ_name,t2.dept_name,t2.dept_id
from (select dept_id,dept_name from a where dept_type = 1) t1,
(select pid,dept_id,dept_name
from A
where dept_type = 0) t2
where t1.dept_id = t2.pid) t11,
B t12,
C t13,
D t14
where t11.dept_id = t12.dept_id
and t12.user_id=t13.user_id
and t13.lh_id=t14.lh_id
group by t11.organ_name,
t11.dept_name
1年前

相关推荐

oracle数据库考题 Which two statements correctly describethe relat
oracle数据库考题
Which two statements correctly describethe relationship among the Scheduler components:job,program,and schedule?(Choose two)
A.A job is specified as part of a program definition
B.A program can be used in the definition of multiple jobs
C.A program and job can be specified as part of a schedule definition
D.A program and schedule can be specified as part of a job definition
roy_20041年前1
liufang2004 共回答了21个问题 | 采纳率100%
and d
oracle数据库。 “表1 有3条数据 如果表1三条数据的status都等于1 ,则赋予表2 “XXX”=1. ”怎么
oracle数据库。 “表1 有3条数据 如果表1三条数据的status都等于1 ,则赋予表2 “XXX”=1. ”怎么写
条件:1.如果表1的n条数据的status都等于1 ,则赋予表2 “XXX”=1.
2.如果表1的n条数据的status都等于2,则赋予表2 “XXX”=2.
3.如果表1的n条数据的status是别的情况,如一些status=1 一些status=2(反正n条数据status不满足都等于1或者都等于2) ,则赋予表2 “XXX”=3.
请问怎么写满足这三个条件sql 语句。
中山美食网1年前1
duqiu723 共回答了21个问题 | 采纳率85.7%
update table2
set xxx = case when not exists (select 'X' from table1 where status1) then 1
when not exists (select 'X' from table1 where status2) then 2
else 3 end
试试吧,不知道对不对
DataStage作业执行报错操作:将oracle数据库数据抽到db2中报错:main_program:Fatal Er
DataStage作业执行报错
操作:将oracle数据库数据抽到db2中
报错:main_program:Fatal Error:An error occurred while loading the DB2 library entry points.
补充:我在测试db2连接的时候没问题,但是执行就报错了

aeslidufhjsdfgs1年前1
mh_s_xu 共回答了18个问题 | 采纳率88.9%
你看下,DS配置的字段类型和数据库的字段类型是否一致,还有报其他错误或警告?
在使用MyEclipse,从Oracle数据库进行逆向工程的时候出错,我使用的是JPA,
在使用MyEclipse,从Oracle数据库进行逆向工程的时候出错,我使用的是JPA,
错误为:
ENTRY org.eclipse.core.jobs 4 2 2010-06-09 09:11:34.031
MESSAGE An internal error occurred during:"Generating Artifacts".
STACK 0
org.hibernate.HibernateException:Hibernate Dialect must be explicitly set
at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:426)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:128)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2005)
at com.genuitec.eclipse.hibernate.wizards.MEJDBCMetaDataConfiguration.readFromJDBC(MEJDBCMetaDataConfiguration.java:72)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$7.execute(GenerateArtifactsJob.java:877)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:91)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.buildConfiguration(GenerateArtifactsJob.java:858)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:405)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
请不要说是什么方言没有设置,也不要说配置hibernate.cfg.xml,这里根本没有hibernate.cfg.xml,
我根本都没有hibernate.cfg.xml这个文件,我用的是JPA
使用MySQL可以进行逆向工程,求解Oracle为什么不行
Jenniferpie1987_gg1年前1
星星变了心 共回答了17个问题 | 采纳率88.2%
不管你是用的hibernate.cfg.xml还是hibernate.properties文件或是其他配置方式,造成这个问题的可能只有两个:
1你的hibernate.dialct这个属性没有配置正确.或者有可能是配置正确而没有调用才会导致这个问题.
hibernate.cfg.xml格式怎么修改就不说了.
hibernate.properties文件格式修改方法:
注意hibernate.properties需放在src目录中,内容如下:
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.password=sa
hibernate.connection.url=jdbc:mysql数据库url
hibernate.connection.username=root
hibernate.dialect=org.hibernate.dialect.MySQLDialect
2.hibernate-mapping配置文件有问题,好好检查table,是否有问题
.楼主不管你用jpa还是什么都得有配置文件吧?jpa是applicatonContext.xml这个文件配置吗?忘了,好像是.
肯定得有地方配置你的数据库连接地址,用户名密码什么的吧?
如果是全放到java类里的,那就是改类,不过类里改的方法不同而已.
汉译英,计算机方面的一小段文字数据迁移是Oracle数据库管理维护的重要内容,为了解决数据库迁移过程中迁移数据量大,宕机
汉译英,计算机方面的一小段文字
数据迁移是Oracle数据库管理维护的重要内容,为了解决数据库迁移过程中迁移数据量大,宕机时间长,数据库平台版本不同等因素造成的迁移失败的问题,本文提出一种类似prebuilt mv的trigger数据迁移方法.该方法可以在线迁移100G以上的大型数据库,还可以解决高可用环境中数据迁移难以解决的最短时间切换,跨平台迁移,跨版本迁移等问题.试验结果证实了该方法的有效性.
xuequan19991年前1
ronade 共回答了16个问题 | 采纳率93.8%
Data migration is an important part of the Oracle database management and maintenance, in order to solve the migration database migration process large volumes of data, downtime for a long time, different versions of the database platform migration issues such as the failure of factors, this paper presents a similar prebuilt mv the trigger data migration methods. This method can migrate 100G more large online database, you can also solve the shortest period of time in a highly available environment difficult to solve switched data migration, cross-platform migration, cross-version migration and other issues. The test results demonstrate the effectiveness of this method.
ORA-12514错误,用sqlplus连接oracle数据库,登陆时出现ORA-12514错误,说service-na
ORA-12514错误,
用sqlplus连接oracle数据库,登陆时出现ORA-12514错误,说service-name不能解析?oracle中net端已经配置好并测通了
sqlplus中tnsnames.ora文件如下:
LISDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.22.141)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = lisdb)
)
)
将service_name变为sid这个不行啊,而且Configuration Assistant配过很多次了已经,
lisdb肯定没有问题,测试已经通过了,另外删掉文件重配也试过了,不成啊,别人的机子同样的配置都没有问题,
晕.
yatou622621年前1
huanle叮咛 共回答了16个问题 | 采纳率100%
LISDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.22.141)(PORT = 1521))
)
(CONNECT_DATA =
(SID = lisdb)
)
)
要不行,把tnsnames.ora删掉,用Configuration Assistant重新建
还不行啊,你确定lisdb是正确的?配的时候测试是否通过?
把..NetworkAdmin下的文件全删掉,再用Configuration Assistant配置试试
甲骨文公司的Oracle数据库,用中文谐音(读音)怎么读?
甲骨文公司的Oracle数据库,用中文谐音(读音)怎么读?
请问甲骨文公司的Oracle 数据库,用中文谐音(读音)怎么读?比如Windows 读为:温豆斯 请尽量表达正确标准些?
怎么回答的答案差那么多,到底怎么读才标准正确,
陈dd20001年前1
hkkCEO 共回答了25个问题 | 采纳率96%
Oracle
欧瑞可
随便你怎么读都可以的.反正字典上没有.
这个单词是由三个音节组成
O就和O my god里面那个O是一样的发音.
ra就和单词“race”里面那个ra一样的发音.
cle就和bicycle里面的那个cle一样发音.
晓得不?

大家在问