'Does Count(Distinct(*)) returns the distinct no of records in a table?

What is the difference between the below codes.

Select count(distinct(*)) from TableName;

Select count(*) from (Select distinct(*) from TableName;

I am running this code on azure Databricks and getting different values after executing both the codes. I am not sure why is this happening. Any help would be highly appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source