I have a table emp , Fields with empname,dnname,dno,salary.
now I want copy distinct salary with all emp detail from emp into new table which is not already exist in database. how would I do this ?

Answers were Sorted based on User's Feedback



I have a table emp , Fields with empname,dnname,dno,salary. now I want copy distinct salary with all..

Answer / prashant

SELECT DISTINCT empname,dnname,dno,salary into New Table
from emp

Is This Answer Correct ?    3 Yes 2 No

I have a table emp , Fields with empname,dnname,dno,salary. now I want copy distinct salary with all..

Answer / b.kumar

WITH CTE
AS
(
SELECT *, ROW_NUMBER() OVER (PARTITION BY SAL ORDER BY SAL) AS ROWID
FROM EMP7
) SELECT * INTO EMP10 FROM CTE WHERE ROWID=1

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL Server Interview Questions

Explain subquery and state its properties?

0 Answers  


what is bit datatype and what's the information that can be stored inside a bit column? : Sql server database administration

0 Answers  


Do you know what is normalization of database? What are its benefits?

0 Answers  


Why use cursor in sql server?

0 Answers  


Write a sql query to delete duplicate records from a table called table1

0 Answers  






how to delete duplicate rows in sql server2005

7 Answers   Cisco, CTS, HCL, IBM,


What is key attribute?

0 Answers  


How to start sql server browser service?

0 Answers  


What the class forname () does?

0 Answers  


What is catalog views?

0 Answers  


What is standby servers? Explain types of standby servers.

0 Answers  


Explain in brief how sql server enhances scalability of the database system?

0 Answers  


Categories