Question : Syntax of computed column at the time of creation of a table

I have aq problem in creating a tabel that must have  a computed column using other columns FROM THE SAME TABEL in mysql i tried this
create table test
(
 col1 int,
 col2 int,
 col3 int as col1+col2
)
 after running this query mysql flagged an error says: invalid syntax near row....

PLEASE HELP!

Answer : Syntax of computed column at the time of creation of a table

YOu cannot do that. There are no computer columns. Besides, you can just compute during retreival:

SELECT col1, col2, (col1 + col2) AS col3 FROM test;

Random Solutions  
 
programming4us programming4us