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 / narasimha

select distinct(sal) sal from salex;

Is This Answer Correct ?    35 Yes 22 No

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

Answer / guest

SQL> DELETE FROM <TABLE_NAME>
WHERE (ROWID,SAL) NOT IN
(SELECT MIN(ROWID),SAL FROM <TABLE_NAME>
GROUP BY SAL);

Is This Answer Correct ?    13 Yes 5 No

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

Answer / yaswanth

select salary from emp where rowid NOT IN(select max(rowid) from emp GROUP BY salary);

Is This Answer Correct ?    14 Yes 7 No

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

Answer / amit

SQL>DELETE FROM <TABLE NAME>
WHERE ROWID NOT IN (SELECT MIN(ROWID) FROM <TABLE NAME>
GROUP BY SAL);

Is This Answer Correct ?    9 Yes 3 No

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

Answer / sarthak mohanty

DELETE
from <table_name> a
where a.rowid > ANY(select b.rowid
from <table_name> b
where a.salary=b.salary);

Is This Answer Correct ?    6 Yes 0 No

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

Answer / priya

select DISTINCT sal from emp;

Is This Answer Correct ?    8 Yes 5 No

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

Answer / bibhudatta panda

DELETE FROM TABLENAME
WHERE ROWID NOT IN(
SELECT MAX(ROWID)
FROM TABLENAME
GROUP BY Sal
)

Is This Answer Correct ?    4 Yes 1 No

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

Answer / abin

Select sal from (Select *,ROW_NUMBER() over (partition by
sal order by sal asc)num from emp) a
Where num=1

Is This Answer Correct ?    2 Yes 0 No

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

Answer / guest

http://www.youtube.com/watch?v=3bCgGrEz8Kw&NR=1
bug
http://www.youtube.com/watch?v=zZdQ6HXXDiE&feature=related
levels of testing
http://www.youtube.com/watch?v=osgaXV4qtZg
software testing

Is This Answer Correct ?    1 Yes 1 No

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

Answer / suneelkumar

delete from emp x where rowid>(select rowid from emp y where
x.sal=y.sal)

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

hello..... i am an comp science engineering graduate planning to do ORACLE certification in PLSQL 9i. just wanted to know whats the possibility getting job is their openings???? is it worth doin that course n certification

1 Answers  


What is indexes?

0 Answers  


What are the two types of cursors in pl sql?

0 Answers  


What is delete command in sql?

0 Answers  


i have a customer table. trans_id trans_date trans_amt debit_credit_indicator 001 01-JAN-13 1099 cr 001 12-JAN-13 500 db 002 24-FEB-13 400 db 002 23-MAR-13 345 cr 001 18-APR-13 800 cr 002 15-MAR-13 600 db 001 12-FEB-13 200 cr i want like this output. trans_id trans_amt debit_credit_indicator i want get highest credit amount and lowest credit amount and highest debit amount and lowest debit amount for each trans_id.

2 Answers   Oracle,






what is variable in package specification

3 Answers  


a. Can you delete data from a View. b. If Yes, can you delete it if there are multiple tables c. If No, can you delete if there is single source table which is joining.

1 Answers   CGI,


if i perform any operation on views such as insert, delete etc will my base table get affected?????

4 Answers  


What steps server process has to take to execute an update statement?

0 Answers  


What is a recursive join sql?

0 Answers  


when normalization is required

3 Answers   HCL,


What is difference between sql and mysql?

0 Answers  


Categories