A. oracle 刪除sql語句怎麼寫
首先你要明確你要刪什麼東西
如果是刪除一個表裡面的數據,那你要明確是全表刪除還是只刪除某一部分數據
表刪除語句: delete from 表名where 要刪除的條件;
如果是全表刪除可以這樣寫:delete from 表名,或者直接裁剪表 truncate table 表名;
B. oracle資料庫刪除表中一條數據SQL語句
保留表,只刪除數困稿據:
truncate table mytable;
或者:
delete from mytable where 1 = 1 ;
commit;刪除表本身:
drop table mytable;
C. SQL刪除語句怎麼寫 要多行刪除
如果是oracle的話:
比如刪除第100條到200之間的記錄:
delete from 表名 where rownum > 99 and rownum < 201
sqlserver的話:
delete from 表名 where top > 99 and top< 201
D. 怎麼用SQL刪除oracle里表的數據
1.保留表,只刪除數據:
truncate table mytable;
或者:
delete from mytable where 1 = 1 ;
commit;
2.刪除表本身:
drop table mytable;
如果要永久性刪除,不準備在恢復:
drop table mytable purge;
不明的可以hi我。
E. 怎麼用SQL刪除oracle里表的數據
1.保留表,只刪除數據:x0dx0atruncate table mytable;x0dx0ax0dx0a或者:x0dx0ax0dx0adelete from mytable where 1 = 1 ;x0dx0acommit;x0dx0ax0dx0a2.刪除表本身:x0dx0adrop table mytable;x0dx0ax0dx0a如果要永久性刪灶坦除,不準備在恢復:x0dx0adrop table mytable purge;x0dx0ax0dx0a不明隱乎桐的可頃殲以hi我。
F. Oracle語句,如果表XXX存在,刪除表XXX,sql語句怎麼寫
方法一
===================================================
set feedback off
spool c:\del.sql
select 'drop table ' || table_name from all_tables
where table_name like 'XXX';
spool off
@@c:\del.sql
方法二
===================================================
delcare
num number(1);
begin
num:=0;
select count(*) into num from all_tables where table_name like 'XXX';
if num >0 then
exexcute immediate 'drop table XXX';
end if
end ;
/
G. Oracle 查詢並刪除重復記錄的SQL語句,如下內容
1、查找表中多餘的重復記錄,重復記錄是根據單個欄位(peopleId)來判斷
select * from people
where peopleId in (select peopleId from people group by peopleId
having count(peopleId) > 1)
2、刪除表中多餘的重復記錄,重復記錄是根據單個欄位(peopleId)來判斷,只留有 rowid最小的記錄
delete from people
where peopleId in (select peopleId from people group by peopleId
having count(peopleId) > 1)
and rowid not in (select min(rowid) from people group by peopleId having
count(peopleId )>1)
注:rowid為oracle自帶不用該.....
3、查找表中多餘的重復記錄(多個欄位)
select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by
peopleId,seq having count(*) > 1)
4、刪除表中多餘的重復記錄(多個欄位),只留有rowid最小的記錄
delete 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)
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)