Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: SQL*Plus and PL/SQL >> why the difference

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: why the difference
 sri  Posted: Feb 19, 2008 04:32:40 AM

 Total Post: 13
 Joined: Sep, 2007






 Hi all
If we have a table of only one column ( say a)
and say we have 5 rows of null values in that column

if we say count(*) it will give 5

if we say count(column_name) it will give 0

why the difference between two queries

can any body please let me know


Thanks in advance...

 Garlapati
Posted: Feb 19, 2008 05:10:55 AM  

 Total Post: 30
 Joined: Apr, 2007






 
count(*) means it takes all duplicate values
but count(column) is not conside null values

it counts only for the perticular column
count(*) means it consider maximum no.of rows are there

 sri
Posted: Feb 19, 2008 05:26:54 AM  

 Total Post: 13
 Joined: Sep, 2007






 
i couldn't get you
can u explain it clearly

 Murtuja
Posted: Feb 19, 2008 06:24:49 AM  

 Total Post: 857
 Joined: Jan, 2006






 
Count on a column does not count nulls.
Count with an asterisk counts all rows even if all columns are null.

 subha
Posted: Feb 22, 2008 02:40:21 AM  

 Total Post: 2
 Joined: Feb, 2008






 
Count(*) considers all rows even it is NULL. Count(Col_Name) ignores NULL values...

 Muhammed El Hedi
Posted: Feb 27, 2008 10:30:54 PM  

 Total Post: 2
 Joined: Feb, 2008






 
select count(column_name) from table_name;
has the same meaning as
select count(*) from table_name where column_name is not null;

 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Gopu Gopi333
  Gitesh Trivedi322
  Vinoth Kumar264
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software