Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6138047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:48:07+00:00 2026-05-23T17:48:07+00:00

Hey guys (and probably girls). I’m modelling a huge database in mysql for a

  • 0

Hey guys (and probably girls). I’m modelling a huge database in mysql for a company that i work and i’m stucked on things that you might help me.

My question is very simple: How do i know that a number of foreign keys is enought ?

I have 8 tables that describes the following datas:

1st relationship

  • table country (pais)
  • table state (estado)
  • table city (cidade)

(city => state => country)

2nd relationship

  • table department (departamento)
  • table sector (setor)
  • table role (cargo)

(role => sector => department)

3rd relationship

  • legal entity (entidade juridica)
  • company (empresa)

(company => legal entity)

And finally i have a ninth table called employee and this table have foreign key references of all the tables previously described.


  • (primary) id-colab
  • fone_colaborador
  • fax_colaborador
  • ativo_colaborador
  • email_colaborador
  • (primary) cargo_id_cargo (cargo table)
  • (primary) cargo_setor_id_setor ( cargo table)
  • (primary) cargo_segor_departamento_id_departamento (cargo table)
  • (primary) empresa_id_empresa (empresa table)
  • (primary) empresa_entidade_juridica_id_entidade_juridica (empresa table)
  • (primary) empresa_entidade_juridica_cidade_cidade_id (empresa table)

  • (fK) cargo table

  • (fk) empresa table

The main concept of this model is.

  • I have a register of a legal entity.
  • legal entity must be placed on country => state => city

  • I have a register of a company

  • Company should inform whether it is a branch or parent company
  • Company should have a referece to the legal entity table (that owns address, phone, state id, city id, country id, postal code and etc…)

  • I have a register of a role

  • Role should have a reference to the sector table
  • sector table should have a reference to the department table

And finally, the main table called employee described on the image above.

I hope you guys have undertood me !

See ya.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:48:07+00:00Added an answer on May 23, 2026 at 5:48 pm

    You can have 100 foreign keys in your table if that’s what’s required to keep your data properly normalized. Don’t worry about the number. Worry about keeping your fields appropriately atomic and your schema normalized.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys I'm getting three things right now that I'm trying to take care
Hey guys I know that this is probably just a simple sql statement but
Hey guys, I do most of my work in MySQL, but have recently been
Hey guys i am trying to automate my system at work for sending artwork
Hey guys quick question, I am currently echoing a lot of javascript that is
Hey guys, I'm currently trying to implement a function using C that takes in
Hey guys I'm creating a quick mysql file to create a DB with some
Hey guys I just noticed that my join statement here SELECT * FROM reports
Hey guys i am currently working on an android app that will allow me
hey guys i wanna ask a question about sending data to database to server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.