首页 > 数据库技术 > 详细

sql思考

时间:2015-12-15 14:04:22      阅读:375      评论:0      收藏:0      [点我收藏+]

-- Create table
create table STUDENT
(
id NUMBER,
name VARCHAR2(100),
age NUMBER,
sex INTEGER
)
tablespace DEMO
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);

技术分享

技术分享

---1.

select * from STUDENT t where 1=1 and (t.id=1 or t.id=2 or t.id=3) and t.age=27

多个or等于in 一个范围

 

---2.

select t.id,t.name,
(select bb.id from banji bb where bb.id=9999 and rownum<2 ) as hh
from STUDENT t
join banji bj
on bj.id=t.id

如果字段查不出来就为null,不会影响其他值。

sql思考

原文:http://www.cnblogs.com/zshboke-2015/p/5047861.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!