Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Tom Dicks
1
Views
4
Comments
Relationships Between Entities
Question
Hi all,
I am a newbie to the Agile Platform development, actually only started to explore it yesterday. Was going through the tutorial topivc 'How to relate database tables with foreign keys', but failed to make sense out of how the two tables (Company and Contact) described relate to each other.
There is a foreign key attribute called CompanyID in the table Contact but how does it link to the table Company since there is no such an attribute in the Contact table. Could someone please assist me in explaining how this is done.
Thank you.
Tables.JPG
Cipriano Teibão
Hello,
What do you mean there is no such an attribute in the Contact table? The contact table has a CompanyId attribute where you store the company ID, and in the company table you have the id. If you put for example CompanyId=5 on a contact, then that contact will be related with the company with id=5.
Robert Chanphakeo
@Tom
Your entity relationship diagram shows that 1 company can have many contacts.
COMPANY 1.* CONTACT.
(company has many contacts)
"
There is a foreign key attribute called CompanyID in the table Contact but how does it link to the table Company since there is no such an attribute in the Contact table. Could someone please assist me in explaining how this is done."
The contact entity table has a foreign key "CompanyId"
Tom Dicks
Yes, there is an Id attribute in the Company table, but I thought this is an automatically generated number. Can I change that number and put my own that I will know when entering records of the Contact table?
Thank you all.
Robert Chanphakeo
@Tom
By default when a identifier key/primary key is created it is an interger datatype with auto numbering enabled.
You could set the number on your own however it is adviced that you have the database auto number the primary key id for you.
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...