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

Re: database strategy

by Zaxo (Archbishop)
on Aug 03, 2002 at 01:33 UTC ( #187265=note: print w/replies, xml ) Need Help??


in reply to database strategy

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://187265]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2023-02-02 07:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (15 votes). Check out past polls.

    Notices?