Re: BLANK OR NULL
Posted in 1996
xavierp@semic.es (Manel Falc') wrote:
:Hi informixers,
:When a table has a key that it may be null
If you by key mean a primary key it can't be null. Replacing it with
blank (space) isn't going to help. Every table *have* to have a
primary key (that is by definition unique in every row).
If you don't do this you are going to get into so much trouble down
the line you risk your entire system.
If there is no natural primary key you may add an extra column with
datatype serial to have one generated automatically for you.
: and this table is
:relationed with others tables with this key,
:Do you put blank or null ?.
Do you mean to do like this:
create table a(
akey char(6),otherdata ...
)
create table b(somedata ...
akey char(6),
moredata...
)
And then you want a.akey to contain null and want to join the a and b
tables where a.akey is null and b.akey is null as well as cases where
a.akey has some (other) value.
That would be tedious indeed.
Putting spaces in both a.akey and b.akey would of course make a
regular join work, but using another default value *might* be a better
idea. Might!
From the look of it it seems your database design is very bad indeed.
You might want to tell us exactly what you want to accomplish (tell us
about your tables and data) and someone might be able to help you.
:Working with null keys can be tedious ... but the blank's option
:I don't know whether it's a good stilus
:
:Ciao,
: Manel
:--------------------------------------------------------------
:Public apology for my English ...
:I'd willingly accept yours grammatical corrections ...
your
Nils.Myklebust@idg.no
NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway
My opinions are those of my company
The Informix FAQ is at http://www.iiug.org