Mysql database structure

Asked

Viewed 332 times

1

Hello I need a small force to structure my data in a database.

I have a table for exam procedures with an id, test name and value. Only the problem is that a "procedure" may contain other procedures, in which case the unit value of each procedure changes.

Example - Separate procedures -Radiography 10.00 -Photo 5.00 -Slide 15.00 -Model 50.00

Example of Group of procedures -Documentation A --Radiography 8.00 -Photos 3.50 -Model 40.00

-Documentacao B --Radiography 8.00 -Photographs 2.50 -Model 40.00

Only these documentation procedures need to reference the id of the separate procedures.

Thank you

1 answer

0


You could ride a schema thus:

Table: Procedures

id (auto-increment)  
procedimentos (Fotografia, Slide, etc)
valor (1.00, 2.00, etc)

Table: Group of procedures

id (auto-increment)
grupo (Documentação A, Documentação B)

Table: Procedures-Group

id_procedimentos (id da tb procedimentos)
id_grupo (id da tb grupo)
valor (Inserir o valor diferenciado)

Searching for the table Group procedures you can obtain individual or differentiated values, in addition to being able to give a GROUP BY in id_grupo, to show your groups.

I hope I’ve helped.

  • Thank you very much!

  • If the answer met you satisfactorily, click on the upper left arrow to score me. Any questions, I am available.

  • I’m with 15 points notice. Thanks for the feedback! Votes cast by those with Less than 15 Reputation are Recorded, but do not change the publicly displayed post score.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.