Finding difference between total value and distinct value in a table
Use COUNT
and DISTINCT
COUNT
.
SELECT COUNT(name)-COUNT(DISTINCT name) AS nameDifferenceFROM city
Output:
nameDifference1
you can use DISTINCT and COUNT.
SELECT COUNT(name) - COUNT(DISTINCT name) FROM city