debugsqlMinor
Question about 'mysql error 1064'
Viewed 0 times
error1064mysqlaboutquestion
Problem
ALTER TABLE sample62 CHANGE newcol c;This code makes me mad. I just followed the book I had.
Program said
You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near '' at line 1.
My MySQL version is 5.7. Can you please help me?
Solution
mysql error 1064
The error that gets thrown if the syntax is wrong. You did not clearly state what you are doing.
If you are changing a column
If you are trying to change column definition
If you are adding a new column
The error that gets thrown if the syntax is wrong. You did not clearly state what you are doing.
If you are changing a column
ALTER TABLE table_name MODIFY COLUMN column_name datatypeIf you are trying to change column definition
ALTER TABLE table_name CHANGE old_column_name new_column_name data_type(size)If you are adding a new column
ALTER TABLE table_name ADD column_name datatypeCode Snippets
ALTER TABLE table_name MODIFY COLUMN column_name datatypeALTER TABLE table_name CHANGE old_column_name new_column_name data_type(size)ALTER TABLE table_name ADD column_name datatypeContext
StackExchange Database Administrators Q#128801, answer score: 3
Revisions (0)
No revisions yet.