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 only how 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 / yaswanth

select distinct(SAL) as SAL from table_name;

Is This Answer Correct ?    17 Yes 2 No

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

Answer / yaswanth

delete from employees where rowid NOT IN(select max(rowid) from employees GROUP BY salary)

Is This Answer Correct ?    7 Yes 2 No

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

Answer / mohannad amarneh

select distinct(sal) from my_table;

Is This Answer Correct ?    8 Yes 4 No

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

Answer / annalakshmi.s

select distinct(salary) from tablename

Example:

employee is the table name

salary is the column name means

select distinct(salary) from employee

Is This Answer Correct ?    3 Yes 0 No

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

Answer / hiya

select n from (select row_number()over (partition by n order
by n) r,n from test group by n having count(*)>1)

Is This Answer Correct ?    1 Yes 0 No

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

Answer / manju

Select sal from emp group by sal having count(*)>=1

Is This Answer Correct ?    2 Yes 1 No

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

Answer / swastik

DELETE FROM Emp A
WHERE ROWID NOT IN
                  (
                   SELECT MIN(ROWID)
                   FROM Emp B
                   WHERE A.Sal = B.Sal
                  )

Is This Answer Correct ?    1 Yes 0 No

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

Answer / suma

can we use group by?

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 / sandeep sudunagunta

Select sal form from my_table group by sal having count(*)>1

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More SQL PLSQL Interview Questions

How many types of tables are there?

0 Answers  


What found sql?

0 Answers  


Which column of the user triggers data dictionary view displays the database event that will fire the trigger?

0 Answers  


Explain character-manipulation functions?

0 Answers  


What are the popular database management systems in the it industry?

0 Answers  






How do I find duplicates in two columns?

0 Answers  


how to Update table Sales_summary with max(sales) data from table sales_dataTable 1. sales_data table Table 2. Sales_summary Region sales Region sales N 500 N 0 N 800 W 0 N 600 W 899 W 458 W 900 I want the Sales_summary After Update like this Region Sales N 800 W 900

8 Answers  


What is the difference between local and global temporary table?

0 Answers  


Which table is left in left join?

0 Answers  


what is the difference between to_char and to_date functions?

10 Answers   Infosys,


How do I kill a query in postgresql?

0 Answers  


how to select alphabets in a one column , for this the table name is PA_TASKS and column name is TASK_NUMBER, In TASK_NUMBER the data like this 1.1.3NN,1.1.4NN,1.5.1NN,1.3.2NE,1.5NN,1NN,1.2NE,1CE , For this i need to disply output as NN,NN,NN,NE,NN,NN,NE,CE, Its some urgent requirement ,thanks in advance

6 Answers  


Categories