I’ve found several examples of an inventory database. But I’m looking for someting a little bit different. I’m working with SQL.
I need to keep track of tooling. Employees can check out tooling and the inventory for that tool will be reduced and a that transaction will be recorded in a (checked_out) table. Easy to far.
When the employee returns the tool or tools the employee has a choice. He can either return the tool to inventory. Still fairly easy. Or he could bring the tool back broken and throw it away, in other words record it to the trash table. Or he could put the tool in the resharpen bin and record it to the resharpen table. This is where I get confused.
Sounds like you need a status on the inventory table. For example, a record for an arbitrary tool can have a status field that is a foreign key in the ‘Statuses’ table. The Statuses table could look like this:
… etc.
Your Inventory table could look like this:
Then, when you calculate inventory, only show records where a tool has a status of ‘1’ for Available. You could also run queries for management to show how many tools are ‘Broken’. Plan for eventually deleting these records once the broken tools are accounted for properly, or, keep them for historical data purposes.
At all costs, avoid creating separate tables for the disposition of any entity in the database. Use a ‘flag’ field (i.e. status_id), so you can add new statuses to an application without needed to infinitely add new tables.