首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

查询时如何把oracle表中为空的字段也显示出来

2013-09-12 
查询时怎么把oracle表中为空的字段也显示出来?namenodegree1张三0001802李四00023王五0003794毛竹0004比如

查询时怎么把oracle表中为空的字段也显示出来?
    name   no   degree
1   张三    0001     80
2   李四    0002    
3   王五    0003     79
4   毛竹    0004     
比如这张表,如果用select * from 表名 ,不显示2,4这两行,如何把这两行把这两行也显示出来,同时degree那里填上null?用pl/sql 怎么写呢?谢谢各位高手指点! Oracle PL/SQL select
[解决办法]
改成左连接。
[解决办法]
select student.no,name,degree from student,score where student.no=score.no(+)

或者

select student.no,name,degree from student left join score  on  student.no=score.no
[解决办法]
左连接,上面已经有人说过了

[解决办法]

SELECT st.no, st.name, nvl(sc.degree, 'null') AS degree
  FROM student st
  LEFT JOIN score sc
    ON st.no = sc.no;

热点排行