I'm trying change the name of a column of my table, but it dont change the name, i have tried this command:
ALTER TABLE book_loan RENAME COLUMN idbook-loan TO idbook_loan;
I'm trying change the name of a column of my table, but it dont change the name, i have tried this command:
ALTER TABLE book_loan RENAME COLUMN idbook-loan TO idbook_loan;
Do you need backticks around the column name with hyphens in it?
Also, you must repeat the data type of the column. Let's say it is INT
( you didn't mention it so that's a guess.
You want this.
ALTER TABLE book_loan RENAME COLUMN `idbook-loan` TO idbook_loan INT;
It's possible MySql doesn't recognize that hyphen-containing name as a schema object name without the backtick delimiters.