I think I would start off by deciding what data are 1:1 -- that is what should you put into the main table. For example:
create table person_data ( id_no int NOT NULL, surname varchar(100) NOT NULL, given_name varchar(100) NOT NULL )

And then tables consisting of 1:many data such as email addresses, phone numbers, etcetera. For example:

create table person_email ( id_no int NOT NULL email_address varchar(100) NOT NULL )
I recommend the use of a surrogate key (i.e. the id_no) because the person's name (the natural key) is subject to change. By using a stable surrogate key, you avoid having to change the key because it stays with the record until deleted.

By using a 1:many table, you have the flexibility of dealing with multiple phone numbers or email addresses. By placing each in a separate row, you avoid the situation where you have multiple values in one field, which is a violation of First Normal Form, and of course by extension, Third Normal Form.

Why worry about normality? Because the power of a relation database lies in the elimination of redundancy, thereby increasing data integrity, and reducing time spent in maintenance. And as a previous reply pointed out, when you get to the point where you are using DBI::DBD to extract the information, you have fewer steps you need to take with Perl.

Good Luck

-----
"Computeri non cogitant, ergo non sunt"


In reply to Re: Building an SQL query by cadfael
in thread Building an SQL query by despair

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.