Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2011
    Posts
    4

    Question about database design - Inheritance

    Hello community;

    Well I have is a doubt regarding the Image Assistant on a part of my database, I'm from peru: D so I hope not to bother much in this community.

    Good work I'm doing for college is a company where the company is CUSTOMER, SUPPLIER and WORKER.

    In the analysis has been sharing some common attribute, and so I created a table PERSON.

    Well then, based upon the PERSON table, we have something like the harencia, and as we pulled the tables you mention, but do not know if this is the best way to manage database, Then I have a Doubt is that in CUSTOMER, there are 2 types here in Peru, Natural and legal, what I'm thinking is to create a Boolean field (will be in the Customer table) that would indicate that it is natural (1) legal (0).

    Now as you know if legal, has a representative who is a person and it is here where you do not know how the relationship.

    And finally, if you register as a legal person the company has a generic name, I mean a company name (Example: PERU SYSTEM SAC), is it possible that you register that name in the "name" table person? or Do I have to create another field in the Customer table that says "razon_social"?, to keep in mind that the provider also has generic name, business name Bone.

    I hope I can help, since it is only here
    Attached Thumbnails Attached Thumbnails ScreenShot233.jpg  

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    I'm going to guess that your Natural person is an actual human being (ser humano), and your Legal person is a corporation (sociedad o corporación) which is a legal entity that has many of the rights and responsibilities of a person.

    If my guess is correct, then I'd add a column named something like serHumano to your Person table, and leave that column NULL for a Natural person and set it to the appropriate id_persona for a Legal person.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Nov 2011
    Posts
    4
    you're right, an individual is a human being, a legal person is a company (company Societies) on the drawing table is the overall standings person that has attributes in common with the other tables, does what I can add soyhuamano field in the Customer table?, because as you tell there are 2 types of customers, the natural and legal, and because my other relationships are based on those tables, eg for the purchase of products, vendor table is related to the provider table for sale of products is related vendendor table and customer table.

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Your post reads as though you created it in Spanish, then posted a pure machine translation of what you wrote into English. That makes it very hard to understand, since the machine needs to make grammatical assumptions in the translation that are impossible for us to review to be sure that we understand them.

    My best guess is that you're asking if adding a Persona.soyHumano column will allow you to do what you originally described. If that column is NULL, then this particular Persona must be a Natural person. If that column is NOT null, then this particular Persona must be a Legal persona "owned" by the Persona that has a persona_id with the same value as this soyHuman column. I think that gives you what you originally described.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  5. #5
    Join Date
    Nov 2011
    Posts
    4
    If I am using a translator because I'm from Latin America, the trouble is that when I translate their responses, it translates it in a way that is not understood and there are some things that I I do not understand, the "soyhumano" field it would like to add in the customer table, because if you look at the image to attach, see that the customer table is derived from the person tableYou have fields in common, if I can will your make the diagram only as serious right you be very grateful that I want to understand it.

  6. #6
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Rephrase and post your question in Spanish. I'm not good at it, but I can get by.

    That way we only have to cope with my problems with Spanish instead of my problems with a machine translators problems!

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  7. #7
    Join Date
    Nov 2011
    Posts
    4
    Listo re formularemos la Pregunta.

    Tenemos en la imagen adjunta el Modelo de una parte de mi Base de Datos que estoy haciendo ahora.

    Como vez en la Imagen tenemos una Tabla Padre llamada "persona" y luego en base a esta tabla sale "cliente","proveedor","trabajador" lo que conocemos como Herencia en POO.

    Como usted sabrá existen 2 Tipos de "Personas", Natural y Jurídica.

    Lo que yo quiero hacer es en la tabla "persona" crear un campo llamado "naturalojuridica" que me acepten 2 Valores: (1)Natural (0) Jurídico (Esto es porque mi Cliente puede ser Natural o Jurídico, Mi proveedor Es Jurídico y mi Trabajador es Natural Así que esto es un atributo que tienen en común y tendría que ir en la tabla "persona" ¿Verdad?).

    Ahora mi Ultima duda con respecto a ello es ¿como Evitar esta Herencia?

    He visto en Internet que tanto la Tabla "cliente","proveedor","trabajador" se Unirían en la tabla "persona", Osea todos los campos de las 3 tablas irían en la tabla "persona". ¿Que Opinas?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •