Can I enter formula in the column for MySQL database?

King picture King · Aug 22, 2010 · Viewed 22.3k times · Source

I wonder if the above can operate the column like the excel.

eg. same row. column 1 : A, column 2 : b, column 3 : A + b.

Answer

Martin Smith picture Martin Smith · Aug 22, 2010

It doesn't look like MySQL supports computed columns as per SQL Server.

You could use a View with these calculated columns in or (if you want the value of the calculation to be persisted so you can search against it using an index) add a column and keep it up-to-date with triggers