码迷,mamicode.com
首页 > 数据库 > 详细

sql思考

时间:2015-12-15 14:04:54      阅读:222      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!