假设需要查看table_a表中包含table_b表中id的所有数据:
select * from table_a where id in (select id from table_b);
括号中的语句查出的是table_b中所有的id。