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 are the authentication modes in sql server? : Sql dba

522


What are the sql commands?

601


What is sqlservr exe?

474


Is hadoop a nosql?

569


What is offset in sql query?

593






What are the different types of constraints?

559


Where the sql database files are stored?

480


What is an index? What are the types of indexes? How many clustered indexes can be created on a table?

550


What is query execution plan in sql?

563


How consistent is the view of the data between and within multiple sessions, transactions or statements ?

1704


What are the packages in pl sql?

566


i have a column which may contain this kind of value: 123*67_80,12*8889_5,34*8_874 ,12*7_7 (can contain space before a comma, and this string length can be anything) now i want to split this value into two column like: column1: 123*67,12*8889,34*8,12*7 column2: 80,5,874,7 use function for this

1063


Is like operator in sql case sensitive?

504


Is not equal in sql?

561


Is and as keyword in pl sql?

509