database - Mysql- Single Sequence Table for all Tables -


i have created database in mysql firebird database. in database there common sequence table(common_id) generates sequence tables (45 tables in database). tables

table1 = sequence (id auto-increment)-the common sequence table table2 = process (sequence, process_number(unique), category_name) table2 = tasks (sequence, barcode(unique), process_number(sequence process table), product_name) 

this database has more 600,000 records. 1 "process" can have many "tasks". questions are: relationship should between "sequence" table , "process/tasks" tables? relationship should between process table , tasks table? how insert in "sequence" table , use "id" in other tables?

this first question , new databases, apologies mistakes.

the relation between sequence , process 1 one, relation between sequence , task 1 one (and same every other table uses sequence table in way). 1 side of relation (process resp. task) don't need exist.

the relation between process , task 1 many.

your insert like

insert sequence values (0); insert process values (last_insert_id(), ....);  insert sequence values (0); insert task values (last_insert_id(), ....); 

by way, in data model table process has 2 primary keys now. might better data model when use process's sequence foreign key in task.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -