Reputation: 481
phpmyadmin
query not work for single quote / apostrophe.
Not Work
ALTER TABLE 'about_team' CHANGE 'position' 'pp' INT( 11 ) NOT NULL
Work:
ALTER TABLE `about_team` CHANGE `position` `pp` INT( 11 ) NOT NULL
Same query but not work, gives 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 ''about_team' CHANGE 'position' 'pp' INT(11) NOT NULL' at line 1
Upvotes: 2
Views: 1176
Reputation: 263703
it is because when you using single
quote, it just means it is a STRING
. Whereas BACTICK
(the second query) means escaping a column.
'about_team' is not equal with `about_team` 'about_team' is STRING `about_team` is a Table Name
Actually backticks enclosing the names are optional since the names used where not on MySQL Reserved Keyword List
.
Usually, single quotes
are used around values while backticks
are for table names and column names.
Upvotes: 5