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

Is id a reserved word in sql?

881


What are sql data types?

760


What are the two types of exceptions in pl/sql?

748


Is sql a scripting language?

701


Explain the difference between triggers and constraints?

723


what are the join types in tsql? : Transact sql

771


Is sql scripting language?

740


How many primary keys can a table have?

741


What is mutating error?

714


How to read/write files from pl/sql?

803


What is crud stand for?

755


How do you run a query?

778


What is field delimiter?

806


how to delete an existing column in a table? : Sql dba

728


Why are cursors used?

805