MySQL Syntax Error #1064 with ON DELETE CASCADE -


for life of me, cannot find out why mysql doesn't statement:

create table if not exists personnel (     id integer auto_increment primary key,     firstname varchar(30) not null,     lastname varchar(30) not null,     role varchar(50) not null,     line_manager integer null,      foreign key (role) references roles(name)         on delete cascade         on update cascade,     foreign key (line_manager) references personnel(id)         on delete cascade         on update cascade ) engine=innodb; 

the resulting output mysql after inserting error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near 'delete cascade update cascade, foreign key (line_manager) references personnel(id) ' @ line 10.

can suggest i'm doing wrong?

hey have check mysql query , works think should check following constraints

1) table roles must have same **engine** innodb 2) length of both column personnel(role) , roles(name) must **equal** 3) column roles(name) must **primary key** 

just check things , think work


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -