distal-attribute
distal-attribute
distal-attribute
distal-attribute

getting error on foreign key

User, date Message
Written by mmernes
10 months ago
Category: General
3 posts since Mon, 14 Oct 13
every time I try to add a foreign key get error
create table employee
(
employeeID int not null auto_increment primary key,
name varchar(80),
job varchar(15),
departmentID int not null references department(departmentID)
) type=InnoDB;

sql(1046) SYNTAX error,it does not like InnoDB
can anyone help please?
Written by ansgar
10 months ago
4960 posts since Fri, 07 Apr 06
What's the exact error message? There is surely more than "Syntax error".
Written by mmernes
10 months ago
3 posts since Mon, 14 Oct 13
you have an error in sql syntax check the manual that corresponds to your mysql server versiĆ³n for the right syntax to use near type=InnoDB at line 7
Written by kalvaro
10 months ago
590 posts since Thu, 29 Nov 07
The TYPE keyword was deprecated since MySQL/4.0.18 and was removed in MySQL/5.1.
Written by kalvaro
10 months ago
590 posts since Thu, 29 Nov 07
From 4.x manual:

The ENGINE and TYPE options specify the storage engine for the table. ENGINE was added in MySQL 4.0.18 (for 4.0) and 4.1.2 (for 4.1). It is the preferred option name as of those versions, and TYPE has become deprecated. TYPE is supported throughout the 4.x series, but likely will be removed in the future.

I suppose you're generating the code manually rather than reporting an issue with HeidiSQL table editor.
 

Please login to leave a reply, or register at first.