plsql仅仅复制表结构

plsql:
create table stage.zzyjzjb_bak as select * from stage.zzyjzjb where 1=2
msqlcreate table a like b

plsql查询具有某一字段的表名 select table_name ,column_name from user_tab_columns where column_name ='VC_CPDM'
重复联合提取

select * from test.fu1 a left join test.fuzhi b on a.ida=b.id1 and b.id2>3 left join test.fuzhi c on c.id3>2 and c.id1=a.ida;

去重

delete from t1 a where a.rowid<(select max(b.rowid) from t1 b where b.id3=a.id3)

闪回技术 flash back

show recyclebin
FLASH TABLE t3 to before drop

强制删除

drop table t3 PURGE

数据库设计第一范式
每个字段不可再分

id numbername varchar2(200);
contact varchar2(200);

以上不是第一范式,联系方式可以分解
可以改为

mid
name
email 
wechat  

第二范式
关键字不存在对任意候选非关键字段的部分函数依赖。
两列之间不存在数学关系

if语法
if v1=’s’ then
elsif v1=’3’ then
end if;
case 在select 中不能加分号

3、查找表中多余的重复记录(多个字段)
select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
5、查找表中多余的重复记录(多个字段),不包含rowid最小的记录
select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)

你可能感兴趣的:(plsql仅仅复制表结构)