Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 does over partition by mean in sql?

970


What is primary key in db?

1002


What are system versioned tables?

1018


How do I trace sql profiler?

967


Is sql scripting language?

1047


How do you update a value in sql?

1034


how to concatenate two character strings? : Sql dba

1091


how can we submit a form without a submit button? : Sql dba

981


What is a scalar value in sql?

1069


Is sqlite good enough for production?

990


What is left join in postgresql?

1035


Is sql a backend language?

1087


how to check myisam tables for errors? : Sql dba

1316


What is the difference between functions, procedures, and packages in pl/sql?

1040


how many sql ddl commands are supported by 'mysql'? : Sql dba

1016