Question

I have an application which deals with ordering some items. The items are stored in a products table. For some of the products the order process and details are different. So i need to identify these by name and have a different ui. Would storing the identifying information as boolean fields in table be appropriate

products(table):

is_abc = true,

is_xyz = false etc

or use a file based approach?

products_id.txt

abc_product_id: 1

xyz_product_id: 2

Would be interested to know if there is a better approach.

Was it helpful?

Solution

I would personally recommend using attributes in the database to describe the products. You could use Boolean values, but let's assume for a moment that you have two processes now and that may change to three or four in the future. In a situation like that a Boolean will not work. I would consider using a look-up table to define the varying processes and use the id of each process in the products table. So for example:

Look-Up Table may contain rows like this: ProcessID = 1, ProcessName = "Some Process" ProcessID = 2, ProcessName = "A Second Process" ProcessID = 3, ProcessName = "Third process used"

Then in your products table you could have a column for ProcessID that would contain the ProcessID from the look-up table.

You could do something similar with details and have a ProductDetails table that defined these and provided a foreign key to the main products table.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top