Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Perl DBI and Foreign Keys

by hdb (Monsignor)
on Apr 08, 2019 at 07:51 UTC ( [id://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?
    Answer:Absolutely.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-03-28 11:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found