Quantcast
Viewing all articles
Browse latest Browse all 60

Lookup table for a one-to-many relationship

I have a tickets table with an id that I need to associate to a lookup table where the counterpart of that data is another id that is controlled from an outside source.

tickets- id- sutfflookup- outside_data_id- ticket_id

I just need to know if the association exists (hence the lookup table) and has a one to many relationship. I know nothing else about the outside_data_id except the id itself and the related ticket_id.

Also I don't want to alter the tickets table as this will only affect a small amount of ticket_id's.

Example

outside_data_id = 1234

Can be related to:

ticket_id = 321ticket_id = 322ticket_id = 900

Would the below lookup table structure work or is there a better way?

CREATE TABLE lookup(   outside_data_id integer,    ticket_id integer)

Viewing all articles
Browse latest Browse all 60

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>