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

what's sql server? : Sql server database administration

0 Answers  


What is the difference between dataadapter and datareader?

0 Answers  


Hello all, I have data like :- year amt 2004 10 2005 20 2006 30 Now i want output as:- 2004 2005 2006 10 30 60 but i have to use here group by on year.So, i need a single query within that i can find.

3 Answers  


What are constraints? Explain different types of constraints?

26 Answers   Emsang, Kendriya Vidyalaya(Kvs), Polaris, Wipro,


I have cleared sbi clerk examination. I am Bachelor in computer application (BCA) graduate. so which type of question related bca in sbi clerk interviews. pls answers me at sejalvaghela@yahoo.co.in.. and also tell me which type of question asked in sbi clerk interview.

1 Answers  






How we can compare two database data?

0 Answers  


Can sql servers linked to other servers?

0 Answers  


when you create a database how is it stored? : Sql server database administration

0 Answers  


Explain the properties of a relational table?

0 Answers  


How to install sql server 2005 express edition?

0 Answers  


What are the differences between INNER JOIN, LEFT JOIN and RIGHT JOIN in SQL Server?

0 Answers   QuestPond,


How will you monitor replication activity and performance? What privilege do you need to use replication monitor? : sql server replication

0 Answers  


Categories