oracle 基础常见问题?求高手指点!
1 select t.res_man_id,t.apply_man_id,t.ctrl_man_id,t......... from warehouse t ,t_userIdName u
select (select u.name from t_userIdName u where u.id=t.res_man_id ) as res_man_name,
..............
(select u.name from t_userIdName u where u.id=t.repair_man_id ) as repair_man_name ,
大家看字段就明白了,XX_man_id,都来自于t_userId 如何最有效率的从 warehouse 表的记录里,将_id 转换成 name ?我总不能用N个字查询吧?
2 select t1.XX, ....,t1.YY, t2.XX, ....,t2.YY,t3.XX, ....,t3.YY.......... from 表1,表2,表3,表4....
where t1.xxx=t2.yyy and t3.xxx = t4.yyy .......
从 t1.xx 到tn.yy 就是我们想要的结果字段。 但是这个些结果字段来自于不同的表,同时这些表之间存在某种关系连接在一起。 对于这种情况。 要如何优化这些查询。
3 from 表1,表2,表3,表4,...... 这种写法是不是效率不好, 用 from t1 left join t2 on t1.mainId=t2.mainid .....
是不是用连接查询要比那种的好?
谢谢大家!
补充问题:
比如说:我们经常像 按类别统计一些数据,同时又想在结果里面,包含某些字段
select id,country_name,..........,count(字段1) as c1 from xxxx k group by type
大家知道 select t.f1, count(t.f9) from t 这样的语句是不行的,f
相关问答:
exp user/password@dbname file=c:\table.dmp tables=jbitaku,jbitakum grants=y
然後按回車鍵 說明: user/password@dbname 分別表示用戶名,密碼和服務名 f ......
private static final String URL = "jdbc:oracle:thin:@localhost:1521:orcl";
private static final String USERNAME = "sys";
private static final String PASSWORD = "s ......
在系统运行的时候总是有一块磁盘始终闪红灯,进入系统后
#topas查看总是有一块磁盘%BUSY为90%以上,
数据库版本:oracle 9.2.0.7
数据文件挂载的节点:/oradata/pcs/ 逻辑卷号lv04
#lslv -l lv04
......
select sum(a.t)from ta a group by ta.a,这条语句将表ta中的数据按照a字段分组汇总t字段。
结果比如:
3 30
4 50
我想得到这个结果:
1 0
2 0
3 30
4 50
5 0
这个结果,请问sql语句怎么写?多谢
nobody ......
eclipse 3.3启动web工程,要连接oracle9i数据库报
严重: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12518, TNS:listener could not hand off cli ......