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

Name three of the features managed by the surface area configuration tool? : sql server security

0 Answers  


What is the Difference beween sql server 2005 and sql server 2008

3 Answers   CMC, Hitech,


What are the types of backup and tell me the difference between full and differential backup?

4 Answers   CTS, TCS,


How does SSIS(Sql Server Integration Services) deffer from DTS(Data Transformation Services)?

0 Answers   MCN Solutions,


select empid empname from employee What is the result for the about query?

4 Answers  






What is the difference between UNIQUE and DISTINCT keywords in DBMS?

0 Answers   Genpact,


hi. suppose one person goal is strong knowledge on SQL.... suggest me ...if he learns SQL SERVER or ORACLE? which is best?

7 Answers   TCS, Unisys, Google,


Explain the database you used in your final year project?

0 Answers   Wipro,


2) Consider a Table name A which has below records ID --- 5 5 5 5 5 Consider another table B which has below records ID -- 5 5 5 5 5 5 5 5 How many rows will be returned by each of the below queries a) select * from A inner join B on A.id = b.ID b) select * from A left join B on A.id = b.ID c) select * from A right join B on A.id = b.ID

2 Answers   Synechron, TCS,


What is stored in the mssqlsystemresource database? : sql server database administration

0 Answers  


what number files will a information contain in SQL Server? How many forms of information files exist in SQL Server? How many of those files can exist for a single database?

0 Answers  


how to implement locking in sql server

3 Answers   Satyam,






Categories