Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^3: Perl DBI and Foreign Keys

by hdb (Monsignor)
on Apr 08, 2019 at 07:51 UTC ( #1232273=note: print w/replies, xml ) Need Help??

in reply to Re^2: Perl DBI and Foreign Keys
in thread Perl DBI and Foreign Keys

Well, there must be some piece of information that is the same in both tables. Otherwise, why would you even think about linking those tables? If not you need to create such a link, say a time stamp or a case number.

If you have such a piece of information, you could put it in a third table, with AUTOINCREMENT index, and then use that index in both tables with the data.

Replies are listed 'Best First'.
Re^4: Perl DBI and Foreign Keys
by Marshall (Canon) on Apr 08, 2019 at 08:37 UTC
    I'm not sure if you saw my update with a "piece of paper" from a crime scene analogy?

    I used the Url as the link between tables because it was easily available and guaranteed unique.
    So why have 2 tables?
    Answer: I didn't want to set or declare a maximum number of columns in the main ScoreCard table.
    Each entry in the ScoreCard table can have an unlimited number of Participants.
    Why use integer id instead of Url?
    Answer: because it would save space. I didn't do it or need to do it in this case.
    Could a situation arise where a human shouldn't be required to enter a unique field for a row and where number of columns is not fixed?

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2023-12-10 07:36 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (38 votes). Check out past polls.