Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

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

For database design in general, see google database normalization, that lists plenty of tutorial sites.

You said on cb that the table you're talking about was constructed without a primary key (a column of unique non-null values) The id column should be it. Realize that this design error may not have a complete solution, and in fact you should hope that the rest of the tables are badly normalized. That will help you because replicated data may give enough clues to reassociate the data to the correct person.

Your strategy for doing that looks reasonable, but I would extract the known good data first, making new tables of everything that has a sane id and of all the other tables' records that are associated to uncorrupted accounts. After deleting the good records from the old tables, then start trying to match the corrupt accounts with the leftovers in the other tables. Ultimately, you may need to contact some people directly and get them to identify transactions. That will be embarassing (one hopes to the designers of that mess).

Your new tables should each have a primary key, and that key should be the only thing used to refer to a record in another table. Consider autoincrement fields for primary keys. Make sure all the other tables have good primary keys. Do not use timestamps for that.

After Compline,
Zaxo


In reply to Re: database strategy by Zaxo
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":



  • 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 drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2023-02-02 12:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (18 votes). Check out past polls.

    Notices?