Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
hey all--

I'm working on some more DBI stuff and have kind of hit a wall. The stopping point is not perl, though, it's the way the databases I'm working with were set up. A brief explanation:

  • four fields: id, last_name, first_name, address
  • id is guaranteed to be unique, not guaranteed to be defined
  • last_name and first_name are guaranteed to be defined, but not to be unique
  • address is probably defined and is probably unique
  • the problem is that I have many different tables, and need to try to bring the information together, but cannot afford to match the wrong information with the wrong person. if I use the id field to identify and compare records across tables, I'll get correct matches but will not process all the records. if I use some combination of names and address, I risk incorrectly matching records where the names are the same and the addresses aren't defined.

    the first reply below is my implementation of a system that matches entries from different tables by id if possible, and if not, by names and address. (thought I should put it in a reply to keep it from cluttering the SOPW page).

    I guess I have three questions: 1) is there a better general strategy to deal with the problem? 2) is the code I have included an effective way of implementing the solution I've suggested, and 3) what suggestions should I make to the people that actually do the db design that might keep this sort of thing from happening with future tables that are created?

    if you feel that the real issue is simply a failure on my part to comprehend something basic and important, please include a link to someplace I can read up on it-- I'm fully aware of just how ignorant I may very well be, but not quite sure what I'm ignorant of! :D

    please do take a look at the code below,
    --au

    In reply to 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":



    • 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?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (2)
    As of 2023-01-29 00:14 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?