-1

I'm new to mysql and would like to know how can I add expression in the column like in msaccess?

What data type should I select? Could I use expression directly in the field?

Suppose I have these fields:

name: ID type: int(11)
name: one type: int(11)
name: two type: int(11)
name: total: [one]*[two]
Navin Rauniyar
  • 10,127
  • 14
  • 45
  • 68

1 Answers1

0

MySQL doesn't have calculated columns. You could however, create a view to simulate this:

CREATE OR REPLACE VIEW my_view
AS
SELECT id, one, two, one * two AS total
FROM   my_table
Mureinik
  • 297,002
  • 52
  • 306
  • 350