关于oracle的两表联查语句

现有两张表:A和B,其中A表的主键是B表的外键,我想查表A中有但在表B中没有的数据,请问SQL语句该怎么写

select a.* from a where a.id not in (select distinct b.a_id from b )

楼上语句好的,但是希望你b表的数据不要太多。因为not in这个东西,数据多了效率会很低,,甚至查询超时出错。

select a.* from a left join b on (a.id=b.id and a.name=b.name) where isnull(b.age)

left join 会更好 使用not in 可以参考 in与exists的效率比较

select a.* from a where not exists (select 1 from b where a.id=b.id);