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.
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.
you can create a view of the table like you mention
like :
create view myview as select a,b,(a+b) as c from table
You can't have columns that automatically contain some neighbouring cell's value or do some calculations with it.
However, in a mySQL query, you can do all the things Excel can, and much much more.
For example, to get the sum of two int
fields:
SELECT column_a, column_b, (column_a + column_b) as total FROM tablename
However, looking at your other questions, I'm not sure whether mySQL is really what you are looking for. It sounds to me like you need an application just like Excel.
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
mysql is a database and not a spreadsheet so no you can't, and you probably shouldn't be anyway.
I suppose the point is that a spread sheet holds AND displays the data - mysql holds the data then you use php to show the data (or similar).
When you retrieve from the database you can do:
SELECT (A+B) AS c FROM table
or when you put into the database you can do the maths.