Can I use objects in a database?

0

I have a case that I do not know which is the best structure of the relational database.

User

  • ID
  • Name

Task

  • ID
  • Name

I want the following conditions to be met

  • A user can assign the task to another user
  • I require that there be a section where you show all the tasks you assigned.
  • My solution was to put a new table called

    Responsible

    • ID
    • Responsible (User.id)
    • Who_assigns (User.id)
    • Task (Task.id)

    Then with programming I would perform a validation:

    if( User.id == Responsable.Quien_asigna ) 
     TareasCreadasPorUsuario.AgregarTarea()
    
    
    Mostrar(TareasCreadasPorUsuario); 
    

    But, I was wondering if it would not be better, or if it was possible to put something like that better.

    Task

    • ID
    • Name
    • Responsible [Responsible, Who_assigns]

    And at the end in programming

    for(Responsable in Tarea.Responsables)
      if( User.id == Responsable.Quien_asigna ) 
         TareasCreadasPorUsuario.AgregarTarea()
    
    
    Mostrar(TareasCreadasPorUsuario); 
    
        
    asked by Cragser 11.06.2018 в 18:55
    source

    0 answers