How reterive duplicate value in SQL?

Answers were Sorted based on User's Feedback



How reterive duplicate value in SQL?..

Answer / justus

create table emp

empid empname
----- --------
101 a
102 b
103 a
104 c
105 a

select empname from emp group by empname having count(empname)>1

Is This Answer Correct ?    12 Yes 2 No

How reterive duplicate value in SQL?..

Answer / sivasiva

create table emp

empid empname
----- --------
101 a
102 b
103 a
104 c
105 a
select empid from emp groupby empid,empname having count>1

Is This Answer Correct ?    17 Yes 12 No

How reterive duplicate value in SQL?..

Answer / satishkulala

select empname from emp group by empname having count(empname)>1

Is This Answer Correct ?    5 Yes 0 No

How reterive duplicate value in SQL?..

Answer / rajesh.a

select count(*),empname from emp group by empname having count(*)>1

Is This Answer Correct ?    4 Yes 0 No

How reterive duplicate value in SQL?..

Answer / jaleel ahamed s

create table emp (empid int,empname varchar)

insert into emp values (101,'a')
insert into emp values (102,'b')
insert into emp values (103,'a')
insert into emp values (104,'c')
insert into emp values (105,'a')

select * from emp

SELECT EmpName,Count(EmpID)Cnt From Emp Group By EmpName
Having Count(EmpName) > 1

Is This Answer Correct ?    2 Yes 0 No

How reterive duplicate value in SQL?..

Answer / ashish jain

create table emp

empid empname
----- --------
101 a
102 b
103 a
104 c
105 a

select empname from emp where count(empname)>1

Is This Answer Correct ?    6 Yes 10 No

Post New Answer

More SQL Server Interview Questions

hi, i have a table called names and field name select * from names name a b c d i want to display like this name a,b,c,d how it is possible Regards Baiju

4 Answers  


What is coalesce and check constraint in sql server?

0 Answers  


Define self join?

0 Answers  


how we can count records as a group of days like sum of records for(four mondays),(four tuesday)........ in a month. group the column for weekdays.

1 Answers  


If we shrink the Databse and Files, how much size is decreased?

1 Answers   TCS,


What is RAID and what are different types of RAID configurations?

8 Answers   Wipro,


what is an extended stored procedure? : Sql server database administration

0 Answers  


What are the different types of backup avaible in SQL SErver

6 Answers   Emphasis, IBM,


What is proper subset of candidate key?

0 Answers  


What is sql server replication? : sql server replication

0 Answers  


you have a table with close to 100 million records recently, a huge amount of this data was updated now, various queries against this table have slowed down considerably what is the quickest option to remedy the situation? : Sql server administration

0 Answers  


What you can do to delete a table without the delete trigger firing?

0 Answers  


Categories