need to know fieldwise count of records available in a table
Can u help
I need to know fieldwise count of records available in a table.
Ex: tablename = contactinfo Fields in table: Name, Dsgn, City
Need the result a开发者_高级运维s
Name = 1000, Dsgn = 990, City = 850
Like that
Anoop
Standard SQL to give number of distinct non-null values uses
SELECT
COUNT(DISTINCT Name),
COUNT(DISTINCT Dsgn),
COUNT(DISTINCT City)
FROM
contactinfo
Just non-null values counting duplicates
SELECT
COUNT(Name),
COUNT(Dsgn),
COUNT(City)
FROM
contactinfo
If you mean fields where the field is not null, then it is a simple:
SELECT count(*) FROM contactinfo WHERE Name IS NOT NULL
and repeat :)
精彩评论