To expand on Zaxo's point a little, if (when you build a new set of tables) you cannot easily define a "natural" primary key, it is perfectly acceptable to create an "artificial" key. The best method of doing this is with a "sequence" in your database.

A hint with normalisation: If you have more than one person at an address, you may create two tables:

  1. Names
  2. Addresses
You then may include an "address_id" (primary key from Addresses) column in your "Names" table, then if there are > 1 person at an address, you would put in the address_id, rather than the entire address detail.

This also has the advantage of flexibility. For example, if for some reason the address changes from street to road, you only have to update it in one spot, not two!

If you wanted to get right into normalisation, the basic idea is to not replicate the same data in more than one spot. For example, you may create a table that has all the different types of streets (street, road, place etc etc), then add that primary key into the address table.


In reply to Re: database strategy by Ryszard
in thread database strategy by aufrank

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.