Modeling Database - Self-relationship

0

My Case

I have a empresa table, this table has known fields like cnpj , razão social and login . This same company can register another one in its catalog of companies. The company registered by it will be only visible to it, and not to others.

What I thought

I am dealing with a self-reliance case, correct. It would put a field in the empresa table pointing to the cnpj of the registering company. Then when I need to display, it is only filtered by the companies registered by the company x. How do I put cnpj and cnpj as the primary composite key?

    
asked by anonymous 16.12.2015 / 13:30

0 answers