Unknown CREATE TABLE syntax error

Clash Royale CLAN TAG#URR8PPPUnknown CREATE TABLE syntax error
I've been staring at this simple CREATE TABLE query for 20 minutes, and I can't figure out why it's throwing an error:
CREATE TABLE
create table `schema_change` (
`schema_change_id` unsigned int not null auto_increment,
`major_release_number` unsigned int not null,
`minor_release_number` unsigned int not null,
`point_release_number` unsigned int not null,
`script_name` varchar(100) not null,
`date_applied` datetime not null,
constraint `pk_schema_change` primary key (
`schema_change_id`
)
);
The error returned is a basic syntax error, but I can't spot any syntax that's incorrect:
#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 'unsigned int not null, minor_release_number unsigned int not
null, point_rel' at line 3
What am I missing?
(Using MySQL version 5.1.73)
2 Answers
2
UNSIGNED is a type attribute, and must come after the type name: INT UNSIGNED, not UNSIGNED INT.
UNSIGNED
INT UNSIGNED
UNSIGNED INT
You muse use unsigned after the type, as it modifies the type of int
int
create table `schema_change` (
`schema_change_id` int unsigned auto_increment,
`major_release_number` int unsigned not null,
`minor_release_number` int unsigned not null,
`point_release_number` int unsigned not null,
`script_name` varchar(100) not null,
`date_applied` datetime not null,
constraint `pk_schema_change` primary key (
`schema_change_id`
)
);
See in action here: http://sqlfiddle.com/#!9/685bf/1
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Aha. Knew it would be something extremely simple. Cheers!
– Kai
12 mins ago