count(*)
--------
select count(*) from tablename ---- It will return total number of rows in the table
count(1)
--------
select count(1) from tablename ---- It's also return total number of row in the table
count(column name)
--------------------
select count(columnname) from tablename ---- It will return total number number of rows
with data(without null) in that column
Example:
----------
create table tablecount(stdname varchar(50))
insert into tablecount values ('abi')
insert into tablecount values ('paranthaman')
insert into tablecount values (null) -----this row inserted null values
select count(*) from tablecount
output--> 3
select count(1) from tablecount
output--> 3
select count(stdname) from tablecount
output--> 2
--------
select count(*) from tablename ---- It will return total number of rows in the table
count(1)
--------
select count(1) from tablename ---- It's also return total number of row in the table
count(column name)
--------------------
select count(columnname) from tablename ---- It will return total number number of rows
with data(without null) in that column
Example:
----------
create table tablecount(stdname varchar(50))
insert into tablecount values ('abi')
insert into tablecount values ('paranthaman')
insert into tablecount values (null) -----this row inserted null values
select count(*) from tablecount
output--> 3
select count(1) from tablecount
output--> 3
select count(stdname) from tablecount
output--> 2
No comments:
Post a Comment