ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Databases  >>  SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
The Difference between 'Count' and 'Count(*)'
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: The Difference between 'Count' and 'Count(*)'
Answer
# 1
'Count': Counts the number of non-null values.
'Count(*)': Counts the number of rows in the table, 
including null values and duplicates.
 
Is This Answer Correct ?    10 Yes 1 No
Guest
 
  Re: The Difference between 'Count' and 'Count(*)'
Answer
# 2
I agree with the above answer
 
Is This Answer Correct ?    4 Yes 0 No
Nikita
 
 
 
  Re: The Difference between 'Count' and 'Count(*)'
Answer
# 3
Count(exp): Counts the number of rows excluding null values.
Count(*) : Counts the number of rows including null and 
duplicates records.
 
Is This Answer Correct ?    4 Yes 0 No
Vijay Dev Saxena
 
  Re: The Difference between 'Count' and 'Count(*)'
Answer
# 4
In SQL Server 2000,
Query:
------
select count from employees
Answer:
------
invalid column name 'count'


In SQL Server 2000,
Query:
------
select count(*) from employees

Answer:
-------
   No column name
   ----------------
1.  20
 
Is This Answer Correct ?    3 Yes 0 No
Selvaraj.v
 
  Re: The Difference between 'Count' and 'Count(*)'
Answer
# 5
count - It returns the non null values
count(*) - It returns the null values and duplicate values
 
Is This Answer Correct ?    4 Yes 0 No
T.lakshmi
 
  Re: The Difference between 'Count' and 'Count(*)'
Answer
# 6
Count(expr) -> returns the number of records in the table 
where the expr is not null in the particular column.
Count(*) -> returns the number of all records in the table. 
(including duplicates and those with nulls)
 
Is This Answer Correct ?    4 Yes 0 No
Vijay Dev Saxena
 
  Re: The Difference between 'Count' and 'Count(*)'
Answer
# 7
Count(column name or exp) returns the no. of records for a 
specific/particular column of table excluding null values 
whereas Count(*) returns all the rows/records in the table 
including duplicated and null values
 
Is This Answer Correct ?    5 Yes 0 No
Sachin Rathi
 
  Re: The Difference between 'Count' and 'Count(*)'
Answer
# 8
Count(column_name) returns the number of records in the 
table where the column value is not null for the particular 
column.
Count(*) returns the number of all records in the table. 
(including duplicates and those with nulls)
 
Is This Answer Correct ?    2 Yes 1 No
Harish Sharma
 
  Re: The Difference between 'Count' and 'Count(*)'
Answer
# 9
count fetches non-null value from out of a query but count
(*) includes null values also.
 
Is This Answer Correct ?    2 Yes 0 No
Manisha
 
  Re: The Difference between 'Count' and 'Count(*)'
Answer
# 10
count - It returns the non null values
count(*) - It returns the null values and duplicate values
 
Is This Answer Correct ?    2 Yes 0 No
Rajeeva Tripathi
 
  Re: The Difference between 'Count' and 'Count(*)'
Answer
# 11
COUNT(column_name): COUNT THE NUMBER OF ROWS EXCLUDING NULL
VALUES.
COUNT(*):COUNT THE NUMBER OF ROWS INCLUDING NULL VALUES AND
DUPLICATES.
 
Is This Answer Correct ?    2 Yes 1 No
Anand
 
  Re: The Difference between 'Count' and 'Count(*)'
Answer
# 12
COUNT(column_name): COUNT THE NUMBER OF ROWS EXCLUDING NULL
VALUES BUT INCLUDING DUPLICATES

COUNT(*):COUNT THE NUMBER OF ROWS INCLUDING NULL VALUES AND
DUPLICATES.
 
Is This Answer Correct ?    0 Yes 0 No
Pradip Jain
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
Can I know,how to Execute Funcion and Trigger through command(Manualy Execution) in MS SQL/SERVER 2005,give me answer with Example.  1
What is the difference between login and a user? TCS7
What is Deadlock? Satyam3
How to retrieve duplicate rows in a table? How to delete the duplicate entries in a table? Leo-Technologies12
Following are some of the question related to below mentioned query? select e1.salary from employee3 e1 where 2= ( select count(distinct(e2.salary)) from employee3 e2 where e2.salary>=e1.salary ) 1) What the query returns? 2) How it works? - Detail explanation (what the sub query does, why it is (where 2=)....etc...Please?  3
I have a website that allows customers to browse and place orders for certain products. I have 2 tables; Customers and Orders. The Customers table holds the customer records and the Orders table holds the orders placed by the customer. Both tables are tied based on the field Cust_ID. Example of the data is shown below: Cust_ID Cust_Name Cust_ID Product Amount Order_Date 1001 John Tan 1001 P-5211 $120.00 2/13/2006 1002 Michael Wong 1001 K-1428 $88.90 1/11/2006 1003 Mary Cheong 1003 C-0923 $82.50 1/27/2006 1004 Ahmad Suffian 1003 K-1428 $88.90 2/2/2006 Write a single SQL statement that extracts all purchase records with the following criteria: 1. Customer names starting with “M” only. 2. Orders placed within the current month only. 3. Amount does not exceed $100.00 The list must be sorted by order date with the latest order showing on top. Techno-Solutions3
WHICH INDEX IS FAST CLUSTER AND NON CLUSTER INDEX L&T2
What is a function? Give some example?  2
how can u select the Distinct values in the table, table having 20 columns , i want all columns  1
create index a on employee(dno) In this,which index was created?  2
what is for foreign key ?? Sabic3
Difference between server.transfer and server.execute method?  1
sql server has its default date format in da form "yy-mm-dd" its possible to convert da current date format of sql server to desired format. Now my question is dat how to get da previous and comin days date in my desired format??  1
Display a roll having miminum marks in two subjects? Patni7
How to Display, Amount of Disk Activity Generated by Transact-SQL Statements?  1
What is the STUFF function and how does it differ from the REPLACE function?  2
I need a query that retrieves info from an Oracle table and a query that retrieves info from a SQL Server table. The info has to be joined together according to Record ID numbers. I have very limited access to the Oracle database but full control of the SQL Server database.How do I join two different queries from two different databases?  1
Define candidate key, alternate key, composite key.  9
Is trigger fired implicitely?  2
What are functions  3
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com