When you need to show values in a SQL table (RDBMS) with an objective to display values which are duplication, and summarize the same value by count it as a numeric. So, you have to write SQL statement and execute it as an example follow;

Table name “ExamResults”

IdStudentGrade
1Steven3.5
2Dave3.7
3Ryan3.25
4Jamie4.0
5Eric3.5
6Robbie4.0
7Peter4.0
8John3.25
9Gary4
10Roy2.85

Above table you will see a student with their grade. So, we need to find “how many students who are get grade 4 in the class?”. This question can be responded with our objective to find duplicated values in a table. You have to design your SQL statement using SELECT & GROUP function as follow;

SELECT field_name, COUNT(field_name) AS icount
FROM TABLE_NAME
GROUP BY field_name

to be

SELECT Grade, COUNT(Grade) AS icount
FROM ExamResults
GROUP BY Grade

Result

Gradeicount
3.52
3.71
3.252
44
2.851

This results will tell us how many student each of grades. The number 1 in a column of “icount” is mean to no student in a class which get that grade more than one people, unduplication.

Additional,  you can specify to see only a duplicated values in the table by define HAVING function  as follow;

SELECT Grade, COUNT(Grade) AS icount
FROM ExamResults
GROUP BY Grade
HAVING COUNT(Grade) > 1

Result

Gradeicount
3.52
3.252
44

Moreover, if you need to see the duplicated value under  your conditions, you can use WHERE as a condition in your statement as follow;

SELECT Grade, COUNT(Grade) AS icount
FROM ExamResults
WHERE Grade<4
GROUP BY Grade
HAVING COUNT(Grade) > 1

Result

Gradeicount
3.522
3.252

NOTE: SQL statements in this content are fine to execute in MSSQL, but can be applied to use in the other, i.e. MySQL, PostgresQL etc.

0 Please encourage me.
(Visited 37 times, 1 visits today)

6 Comments

  1. hell March 5, 2020 at 9:00 AM

    Quality content is the crucial to invite the visitors to visit the web site, that’s what this site is providing.

    Reply
  2. living April 3, 2020 at 7:50 AM

    Hi, just wanted to say, I loved this article. It was inspiring.

    Keep on posting!

    Reply
  3. satta king 2020 August 3, 2020 at 6:53 PM

    I’m not sure exactly why but this website is loading very slow for me.

    Is anyone else having this problem or is it a issue on my end?
    I’ll check back later and see if the problem still exists.

    Reply
  4. gay0day January 13, 2021 at 8:00 PM

    There’s certainly a lot to find out about this subject.
    I really like all of the points you have made.

    Reply
  5. top tgirl porn January 14, 2021 at 5:26 AM

    Hi there! I could have sworn I’ve visited this web site before but
    after going through some of the articles I realized
    it’s new to me. Anyways, I’m definitely delighted I stumbled upon it and
    I’ll be book-marking it and checking back regularly!

    Reply
  6. zeenite January 14, 2021 at 5:19 PM

    These are truly great ideas in regarding blogging. You
    have touched some pleasant things here. Any way keep up wrinting.

    Reply

Leave A Comment

Your email address will not be published.