Skip to content
Advertisement

Can SQL replicate Excel’s auto-updating cells based on other cells? [closed]

I have a database of some devices, each with details on their status for things like maintenance schedule, last calibration date, age, warranty status, etc. One of the points of this database is to give us a yes/no answer whether it should be in service or not, based on all these other data points being a certain way. If this was Excel, I could make a cell and use IF statements to get this automatically, and any time one field like warranty fell out of date, the “in service” field would also switch to “No”.

Is it possible for a MySQL database to do this automatically?

Advertisement

Answer

Yes. If all the values you need are in one row, you can use a generated column.

If values needed for the calculation come from other rows or tables, then you can use a view.

Other than that, it is hard to provide more specifics because you question lacks helpful details.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement