Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help, question about Oracle count distinct 1

Status
Not open for further replies.

pandatime

Programmer
Jan 29, 2010
92
AU
Hi,

I am not an Oracle person (anymore) and I need help with this question, please :)

If you do:

SELECT COUNT (UNIQUE id) FROM myTable

are the NULL id's counted also??? That is, if you have
id = 1, two id's = 2, and several id's is null, the COUNT would be 3?

Thank you!!
 
No.

Code:
SQL> create table a (a number);

Table created.

SQL> insert into a values (1);

1 row created.

SQL> insert into a values (null);

1 row created.

SQL> select count(distinct a) from a;

COUNT(DISTINCTA)
----------------
               1


Retired (not by choice) Oracle contractor.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top