SQL::
Updating the column with value as D when it is duplicated.
Please go through the process.............................!
create table Emp_testing as select * from emp;//Creating the Table
select * from Emp_testing;
insert into Emp_testing values('7369','SMITH','CLERK','7902','17-DEC-80','800','','20');
insert into Emp_testing values('7369','SMITH','CLERK','7902','17-DEC-80','800','','20');
insert into Emp_testing values('7369','SMITH','CLERK','7902','17-DEC-80','800','','20');
insert into Emp_testing values('7369','SMITH','CLERK','7902','17-DEC-80','800','','20');
commit;
alter table Emp_testing add status varchar2(4);
select empno,ename,job,mgr,hiredate,sal,comm,deptno,status,count(1) as counts
from Emp_testing group by empno,ename,job,mgr,hiredate,sal,comm,deptno,status;
UPDATE Emp_testing t2
SET t2.status = 'D'
WHERE t2.rowid > (SELECT min(t1.rowid)
FROM Emp_testing t1
WHERE t1.ename=t2.ename);
you will the output in Status column with D value it indicates that Those are duplicates
Updating the column with value as D when it is duplicated.
Please go through the process.............................!
create table Emp_testing as select * from emp;//Creating the Table
select * from Emp_testing;
insert into Emp_testing values('7369','SMITH','CLERK','7902','17-DEC-80','800','','20');
insert into Emp_testing values('7369','SMITH','CLERK','7902','17-DEC-80','800','','20');
insert into Emp_testing values('7369','SMITH','CLERK','7902','17-DEC-80','800','','20');
insert into Emp_testing values('7369','SMITH','CLERK','7902','17-DEC-80','800','','20');
commit;
alter table Emp_testing add status varchar2(4);
select empno,ename,job,mgr,hiredate,sal,comm,deptno,status,count(1) as counts
from Emp_testing group by empno,ename,job,mgr,hiredate,sal,comm,deptno,status;
UPDATE Emp_testing t2
SET t2.status = 'D'
WHERE t2.rowid > (SELECT min(t1.rowid)
FROM Emp_testing t1
WHERE t1.ename=t2.ename);
you will the output in Status column with D value it indicates that Those are duplicates
No comments:
Post a Comment