Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2023-02-03 07:45 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (24 votes). Check out past polls.