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 is a subquery in sql?

732


What is your daily office routine?

2008


what are date and time intervals? : Sql dba

794


What is the difference between left outer join and left join?

731


How do I view a sql database?

778


What are records give examples?

774


what are the limitations of identity column? : Transact sql

853


1) Synonyms 2) Co-related Subquery 3) Different Jobs in Plsql 4) Explain Plan 5) Wrap 6) Query Optimization Technique 7) Bulk Collect 8) Types of index 9) IF primary key is created then the index created ? 10) Foreign Key 11) Exception Handling 12) Difference Between Delete and Trunc 13) Procedure Overloading 14) Grant Revoke 15) Procedure Argument types. 16) Functions. 17) Joins

1366


What do you mean by stored procedures? How do we use it?

742


What is a sql instance vs database?

795


Is sql developer case sensitive?

742


Enlist the advantages of sql.

778


What is native sql query?

772


Why partition by is used in sql?

762


What is file based approach?

684