What is the Query to print out the individual total number of
duplicate row in sql.

Answer Posted / girija.112

ANS:

SELECT department_id,COUNT(department_id) AS "Occurrences"
FROM departments
GROUP BY department_id
HAVING ( COUNT(department_id) > 1 )

DEPARTMENT_ID Occurrences
------------- -----------
80 2
60 3

--In my 'departments' table , i have not assigned department_id column as a "primary key / unique key"

Is This Answer Correct ?    28 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is primary key sql?

713


How many types of keys are there in sql?

756


What is sql architecture?

745


Does sql full backup truncate logs?

747


What is the difference between database trigger and stored procedure?

739






Explain scalar functions in sql?

772


What is mdb stand for?

733


Which is faster count (*) or count 1?

757


How do I run a program in pl sql?

699


What will you get by the cursor attribute sql%rowcount?

759


What does pragma mean?

712


Mention what does plvtab enables you to do when you showthe contents of pl/sql tables?

903


Which is the correct statement about truncate and delete?

757


Can we enter data in a table in design view?

713


Can we rollback truncate?

719