Adrian
Adrian

Reputation: 16735

Referencing a table from the column of another table

Last night, my son told me he wanted to research technology companies. Simple enough, I thought, and I fired up a spreadsheet. As we dug into it, I discovered a flat spreadsheet would be insufficient for what we're trying to do, as the companies he's interested are constantly getting acquired or acquiring others. I looked around for free database programs and it seems MySQL would be a good way to handle the data we've encountered. I'm familiar with Core Data in iOS, but MySQL is new to me. While I wait for my copy of Murach's MySQL, 2nd Edition to arrive later today, I'm curious how I would make a field in one table reference another table?

Here's my EER Diagram (updated):

enter image description here

Let's say I've got a company that gets acquired by another company, how would I make the company table a column in the acquirer table?

Upvotes: 1

Views: 598

Answers (1)

varnit
varnit

Reputation: 1907

you make a different table and name it like acquire table then include two columns in this table both should be foreign key where one column should refer to company id table and one column should refer to acquirer table company id this you can easily achieve what you want if you want help with queries or any other thing let me know

Upvotes: 2

Related Questions