SELECT VERSION();
|
|
# Initial SQL for Create Table
|
CREATE TABLE `testTableWithComment`(
|
`i` INT NOT NULL COMMENT 'A comment!' CHECK (`i` > 5),
|
PRIMARY KEY (`i`)
|
) ENGINE=INNODB;
|
|
# Get the Create Table SQL
|
SHOW CREATE TABLE `testTableWithComment`;
|
/*
|
CREATE TABLE `testTableWithComment` (
|
`i` int(11) NOT NULL CHECK (`i` > 5) COMMENT 'A comment!',
|
PRIMARY KEY (`i`)
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
*/
|
|
/* When the above is run, you get:
|
Error Code: 1064
|
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMMENT 'A comment!',
|
PRIMARY KEY (`i`)
|
) ENGINE=InnoDB DEFAULT CHARSET=lati' at line 10
|
*/
|
|
# Altering Table
|
ALTER TABLE `testTableWithComment`
|
ADD COLUMN `q` INT NOT NULL COMMENT 'A boring comment' CHECK (`q` > 2);
|
|
# Get the Create Table SQL
|
SHOW CREATE TABLE `testTableWithComment`;
|
/* Same issue with the new column:
|
CREATE TABLE `testTableWithComment` (
|
`i` int(11) NOT NULL CHECK (`i` > 5) COMMENT 'A comment!',
|
`q` int(11) NOT NULL CHECK (`q` > 2) COMMENT 'A boring comment',
|
PRIMARY KEY (`i`)
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1*/
|