one of the column in my table contains the data like
SAL
----
1000
1000
2000
3000
3000

So my requirement is i want output like
SAL
---
1000
2000
3000

it mean i want to delete duplicate rows in the table
permanently and i want output in the above formatow should u
write query?

Answers were Sorted based on User's Feedback



one of the column in my table contains the data like SAL ---- 1000 1000 2000 3000 3000 So ..

Answer / dinesh kumar

delete from table_name alias1
where rownum < ( select max(rownum) from table_name alias2
where alias1.col1 = alias.col2 );

Is This Answer Correct ?    0 Yes 0 No

one of the column in my table contains the data like SAL ---- 1000 1000 2000 3000 3000 So ..

Answer / destiny

create table salary2 as select distinct * from salary1
drop table salary1
rename salary2 to salary1

Is This Answer Correct ?    0 Yes 0 No

one of the column in my table contains the data like SAL ---- 1000 1000 2000 3000 3000 So ..

Answer / muthukumar

Select Sal From Emp
Group By Sal

Is This Answer Correct ?    3 Yes 4 No

Post New Answer

More SQL PLSQL Interview Questions

Types of backups ?

3 Answers   TCS,


How do you delete duplicates in sql query using rowid?

0 Answers  


What is the Query to print out the individual total number of duplicate row in sql.

5 Answers   TCS,


Dear All, Question for this Week Find out possible error(s) (either at compile time or at runtime) in the following PL/SQL block. State the reason(s) and correct the errors. Declare Cursor C1 is select ename, sal, comm from emp; Begin For i in C1 Loop If i.comm between 299 and 999 then Dbms_output.put_line(i.Ename || ‘ ** Good Commission’); Elsif i.comm > 999 then Dbms_output.put_line(i.Empno || ‘ ** Very Good Commission’); close C1; Else Dbms_output.put_line(i.Ename || ‘ ** ’ ||nvl(i.comm,‘O’)); End if; End Loop; End;

7 Answers   Accenture,


how to saw triggers output in pl/sql database?

1 Answers  






3. Select sum(a) sum_1,max(a) max_1 ,count(a) count_1 from ( ( select 1 a from dual union all Select to_number(‘2011’) a from dual union all select 1 a from dual) union select 2 b from dual);

1 Answers   Fintellix,


What is indexing in sql and its types?

0 Answers  


What is left join example?

0 Answers  


Why do we use sql constraints?

0 Answers  


Can we use the cursor's to create the collection in PL/SQL?

0 Answers   MCN Solutions,


Can dml statements be used in pl/sql?

0 Answers  


Is left join faster than inner join?

0 Answers  


Categories