What is the difference between the following two sql
statements
select count(*) from <tablename>
select count(col_name) from <tablename>

Answer Posted / debasis

select count(*) from <tablename> returns the number of rows
in the table.

select count(col_name) from <tablename> return number
values in the column (Ignores null value in the colum). For
example if we execute the following 2 queries then

select count(*) form emp
select count(comm) form emp

The result will be
14
4

Is This Answer Correct ?    34 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why main is user defined function?

573


What is the name of the system variable that returns the number of rows affected by a SQL statement?

573


What is ms sql server reporting services?

514


How do we Backup SQL Azure Data?

86


How to include date and time values in sql statements?

636






When we should use and scope of @@identity?

559


What are the different type of replication in sql server?

544


What is sql server english query?

547


your sql server is running out of disk space. You notice that there are several large files with ldf extensions what are these files? : Sql server administration

578


my name is sejal I have cleared the sbi clerk exam. I am BCA graduate My favorite subject RDBMS Relational database management system. so please send me rRDBMS related interview questions

1541


What is attribute relationships, why we need it? : sql server analysis services, ssas

510


What is single-user mode?

526


Create a dts package to produce a text file using the ‘update statistics’ command for the tables in a database with obsolete statistics.

536


What sql server means?

564


Does full backup break log chain?

554