RE: Address fields and nulls

Tech-Archive recommends: Fix windows errors by optimizing your registry



There are different schools of thought on the legitimacy of NULL in a column
position in a row in a table, even amongst the great and the good. Date
considers them illegitimate, as only legitimate values of the attribute type
are allowed, and NULL is the absence of a value. Codd, as Date himself
points out, implied support for their use by his advocacy of a 3-way logic
(NULL = 'maybe').

At a more practical level whether you can allow Nulls in columns such as
your County column for instance depends on to what degree the tables are
normalized. This very question came up for a contact of mine in Paris who
was developing a database of members of an international organisation. In
some countries there are regional geographical units between city and
country, states in the USA, départements in France, cantons in Switzerland
etc, but in very small countries there is no regional structure.

A set of correctly normalized tables in this context would include Cities
(in this database all addresses included a 'city' even though it often might
better have been described as a town or village), Regions and Countries, but
if the RegionID foreign key column in a row in the Cities table is left Null
for a city in a country with no regional structure, then there is no way of
knowing which country the city is in, as the key of Countries is referenced
by a CountryID column in Regions, not by any column in Cities.

The answer is to define the Region column in Cities NOT NULL ('required' in
Access table design view) and in the Regions table have rows for each country
without a regional structure with a value of N/A in the region column and the
relevant value for the country in question in the CountryID column. So by
entering the relevant RegionID value in Cities for the N/A region of the
country in question the country in which the city is located is known.

So, in answer to your question, it partly depends on whether you are in the
Chris Date camp or, like most of us, are more cavalier in your adherence to
the principles of the relational model, and partly on whether in the context
any information is lost by the use of Nulls. In your case if your database
is restricted to addressees in Connecticut (assuming it is Hartford CT you
refer to) then obviously nothing is lost by allowing Nulls, but if your
database covers other states and the tables are correctly normalized, then
allowing a Null CountyID in a Cities (or whatever local unit you use) table
would be inappropriate.

Ken Sheridan
Stafford, England

"vlh" wrote:

Hello everyone,

Being new I have a basic question. In setting up a table that includes
addresses should I set the default value to "unknown" (or some other default
value) if a complete address is not given? For example, some address will be
provided without the county or without a second line for the address such as
apartment number or suite number.
I am hesitant to leave nulls as I may be asked to search for all addresses
that do NOT include Hartford county for example and don't want to miss all
those nulls for the participants that did not provide a county.

Thanks,
VLH

.



Relevant Pages

  • Re: Time to talk about Global Warming [was Re: Maccies arent fanatical? (by the way, what is a "Macc
    ... Yes it does depend on how one defines freedom. ... Discharge a firearm in the city and you'll get ... In the country, just put one up. ... cities can do that people living in rural areas can't. ...
    (comp.sys.mac.advocacy)
  • Re: Something to think about
    ... not cities and you'll see the light. ... Do you think they would live in the country with no services available? ... I really think that is the biggest flaw in the "Great Society" ... They piled all the welfare money up in the city where the ...
    (rec.boats)
  • Re: San Francisco So Far
    ... city and country. ... talking real country, as in I can see horses across the street out my ... Many of who live in Cities can't understand how country hicks do it ... parks of all types and historic attractions. ...
    (rec.food.cooking)
  • Re: San Francisco So Far
    ... city and country. ... Many of who live in Cities can't understand how country hicks do it ... I'm a reformed country bumpkin... ...
    (rec.food.cooking)
  • Re: My Hurricane Katrina Predictions
    ... >country on the planet. ... That's about the limit of food stocks in the cities. ... had too short a history to think that the disaster would ever repeat. ... Our public educational system would be first rate, ...
    (talk.origins)