외래키 테이블 생성 0 2 1,166

by 작은눈 [MySQL] [2013.08.23 19:51:09]


create table user_education(
 no int not null auto_increment,
 user_no int not null,
 finish int default '1',
 finish_no varchar(50),
 want text,
 index (user_no),
foreign key(user_no) references user_info(no)
 on delete cascade
 on update cascade,
 primary key(no)
 )TYPE=innodb;

여기서 

#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 'TYPE=innodb' at line 6

이런 에러가 뜨게 되는데 왜 오류뜨는지 모르겠스빈다.
by l2monkeys [2013.09.24 16:00:03]

mysql> create table user_info ( 
    -> no int not null auto_increment,
    -> index (no)
    -> )ENGINE=INNODB;
Query OK, 0 rows affected (0.01 sec)
mysql> create table user_education(
    ->  no int not null auto_increment,
    ->  user_no int not null,
    ->  finish int default '1',
    ->  finish_no varchar(50),
    ->  want text,
    ->  index (user_no),
    ->  foreign key(user_no) references user_info(no) on delete cascade on update cascade ,
    ->  primary key(no)
    ->  ) ENGINE=InnoDB;
Query OK, 0 rows affected (0.00 sec)

by 아발란체 [2013.09.24 16:28:30]
TYPE=innodb >> ENGINE=InnoDB
댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입