how to retrieve only duplicate values in a table

Answer Posted / sri

For example,u have a table called student like below.

STUD-NAME SUBJECT
--------- ------
STUD1 A
STUD2 B
STUD2 A
STUD1 A

in this structure 1 row is duplicated in 4 th. so we can
fetch the student name using the below qry.

SELECT stud-name FROM STUDENT
GROUP BY stud-name,subject
HAVING COUNT > 1.

Is This Answer Correct ?    12 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does an inner join do?

853


What is sql prepared statement?

778


What are the different operators available in sql?

802


Write the order of precedence for validation of a column in a table? I. Done using database triggers. Ii. Done using integarity constraints

886


how is myisam table stored? : Sql dba

823


How do I save the results of sql query in a file?

762


What are inner and outer joins examples of both?

745


How can we make an if statement within a select statement?

794


What are two statement types in sql?

796


what are the different tables present in mysql? : Sql dba

740


how can you create an empty table from an existing table? : Sql dba

905


Which is faster union or join?

748


Does postgresql run on the cloud?

846


What are database links used for?

798


How do you delete duplicates in sql query using rowid?

771