查询登录用户下的所有表 :
select * from user_tables;
两张相同结构表,查询不同数据(应用场景,临时表定时获取数据,总表有所有数据,临时表增量往总表插入数据)
from table_temp tp --临时表
where not exists (select *
from table_total ta --主表
where tp.key1 = ta.key1 --主键关联
and tp.key2 = ta.key2
and tp.key3 = ta.key3)
---这样就会查询出tp表中比ta表中多出来的数据