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 is a nested table in word?

909


What does fetching a cursor do?

1019


what are the differences between procedure-oriented languages and object-oriented languages? : Sql dba

970


How do you take the union of two tables in sql?

933


what are the advantages and disadvantages of cascading style sheets? : Sql dba

1005


Is stored procedure faster than query?

914


How can you save or place your msg in a table?

952


what are the type of locks ? : Sql dba

897


Which is faster union or join?

901


What is the use of non clustered index?

928


What programs use sql?

941


What is meant by truncate in sql?

1003


What is set serveroutput on?

1087


what is the difference between mysql_fetch_object and mysql_fetch_array? : Sql dba

985


Do ddl statements need commit?

922