Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does this ALTER TABLE query throw syntax error?

This is the query I'm using:

ALTER TABLE apartment ADD technical TEXT NOT NULL AFTER is_sale

Why does it produce a syntax error?

EDIT:

ALTER TABLE apartment ADD COLUMN technical TEXT NOT NULL AFTER is_sale still produces an error:

Error: (1064) 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 'ALTER TABLE andreevka_apartment ADD COLUMN technincal TEXT NOT NULL AFTER' at line 1

Also doesn't validate: http://developer.mimer.com/validator/parser200x/index.tml#parser

like image 634
sbichenko Avatar asked Feb 17 '23 12:02

sbichenko


1 Answers

It actually turned out that my query was copy-pasted from PhpMyAdmin and had some encoding issues. I pasted it into Notepad++, converted it to ANSI and it worked. Weird.

The syntax was perfectly fine.

like image 134
sbichenko Avatar answered Feb 25 '23 03:02

sbichenko