mySQL unexpected syntax error with "DECIMAL" -
this 5th day learning sql on mysql.
i don't understand why system tells me following error.
my code is:
create table elements( name varchar(20), symbol varchar(2) primary key, atomicnumber tinyint, atomicmass dec(4,2) -- ending doesn't need , similar sas ); insert elements values ('actinium','ac',89,227); -- here want modify field type of existing table because aluminum has decimal #'s in mass alter table elements modify atomicmass decimal(9,3); -- q: not understand why syntax error.
system message: "syntax error: unexpected 'decimal(decimal)'" runs , changes field constraint error message still there.
additional question(utterly noob question,please tolerate me): how put 'space' in name of column? i'm using "atomicnumber" want "atomic number."
thanks! :)
consult https://dev.mysql.com/doc/refman/5.6/en/alter-table.html.
you missing column
.
alter table elements modify column `atomicmass` decimal(9,3);
Comments
Post a Comment