Reputation: 61
CREATE TABLE movie(
id int() NOT NULL AUTO_INCREMENT,
name varchar() NOT NULL,
type int() NOT NULL default 0,
year int() NOT NULL default 0,
leadactor int() NOT NULL default 0,
director int() NOT NULL default 0,
PRIMARY KEY(id),
KEY type(type.year)
);
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 ') NOT NULL AUTOINCREMENT default 0, name varchar() NOT NULL default 0, type ' at line 2
I have no idea how to fix this. I'm using the newest xampp version.
Upvotes: 1
Views: 782
Reputation: 1269633
Either remove the ()
after int
or include a number. varchar()
requires a value. And, the period in the last row should be a comma:
CREATE TABLE movie (
id int NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL,
type int NOT NULL default 0,
year int NOT NULL default 0,
leadactor int NOT NULL default 0,
director int NOT NULL default 0,
PRIMARY KEY(id),
KEY type(type, year)
);
Here is a SQL Fiddle.
Upvotes: 1