Last post Mar 01, 2017 05:11 PM by march11
Feb 19, 2017 10:55 AM|tangara|LINK
I am requested to come up with the database schema with relationship between tables.
Now, using the reference database, there is this workflow table which contains as follows:
ID int PK, not null
Status (varchar(50), not null
next-Status (varchar(50), not null
And then this status also appears in my RequestOrder Table.
But, I can't put Status as my Foreign Key in my RequestOrder Table right ?
How should I draw the line between these 2 tables ? It is many to 1 but I am stuck cos the PK - ID doesn't appear in the Request Order Table.
Hope to get some advice. Tks.
Feb 27, 2017 04:55 PM|march11|LINK
what else is in RequestOrder Table?
Why not add the PK from ePMT_Workflow, or at least combine it.
If Status is in RequestOrder append ePMT key to status when stored in RequestOrder, you'll need to parse it but at least you can get to it uniquely.
Feb 27, 2017 04:56 PM|PatriceSc|LINK
This is your own workflow tables or are they part of some product? It seems you know which cardinality to use but how do you relate one table to the other if you have no explicit link? Seems the relation is just enforced using a rule rather than really a
referential integrity stored in the db ?
Feb 28, 2017 12:07 AM|tangara|LINK
This is a self created table with the workflow as follows
Id,status, next_workflowId, status, next_Status, workflow_taskID, next_workflow_taskId, action, descripton
And the details of the above column fields are inserted using sql; meaning there is no application module that do this part
How do I draw the relation link in this case?
Feb 28, 2017 03:29 PM|march11|LINK
You are going to have to include a key in either direction.
Ideally you would be creating a many to one relation. But a one to many will work as well if you place the correct fields in each table. You may even need a third table.
Feb 28, 2017 03:43 PM|PatriceSc|LINK
And how do you relate both tables? It seems for now that you modeled the db so that the relation is implicit rather than explicit? You can't "draw a link" if the relation is nout built into the database design but is rather done using some rule.
For now it seems you know how those tables are linked but as you said you have no fk so how do you relate them (or I misunderstood something you want to design something, my understanding is that you have an existing db and one asked you to show relations
Mar 01, 2017 05:11 PM|march11|LINK
If you are free to build your own table schema for RequestOrder, then please show us what you intended and we can recommend other ways.