NULL OR ZERO

Started by Omar Bettinalmost 18 years ago4 messages
#1Omar Bettin
o.bettin@tiscali.it

Probably I am on the wrong place but for me NULL on numbers means 0 or ZERO.
I know about standards...

but I think that integralism is somewhat wrong.

Omar
a programmer...

#2Jaime Casanova
systemguards@gmail.com
In reply to: Omar Bettin (#1)
Re: NULL OR ZERO

On Feb 3, 2008 7:26 PM, Omar Bettin <o.bettin@tiscali.it> wrote:

Probably I am on the wrong place but for me NULL on numbers means 0 or ZERO.
I know about standards...

NULL means unknown value, ZERO is a known value

--
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook

#3Andrei Kovalevski
andyk@commandprompt.com
In reply to: Omar Bettin (#1)
Re: NULL OR ZERO

Hello,

Omar Bettin wrote:

Probably I am on the wrong place but for me NULL on numbers means 0 or
ZERO.
I know about standards...

You can easily convert NULLs to 0 in your queries - read about COALESCE
function
http://www.postgresql.org/docs/8.0/interactive/functions-conditional.html.
Compare these SELECTs:

CREATE TABLE test (num INTEGER);
INSERT INTO test VALUES (1), (2), (null), (3), (null), (4), (0);

SELECT num FROM test;

SELECT COALESCE(num, 0) FROM test;

but I think that integralism is somewhat wrong.

Omar
a programmer...

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

--
Andrei Kovalevski
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, ODBCng - http://www.commandprompt.com/

In reply to: Jaime Casanova (#2)
Re: NULL OR ZERO

On Feb 3, 2008 7:41 PM, Jaime Casanova <systemguards@gmail.com> wrote:

On Feb 3, 2008 7:26 PM, Omar Bettin <o.bettin@tiscali.it> wrote:

Probably I am on the wrong place but for me NULL on numbers means 0 or ZERO.
I know about standards...

NULL means unknown value, ZERO is a known value

NULL represents absence of a value. You get the UNKNOWN truth value if
you compare NULL with any data value or another NULL (damn you, 3VL!).