programing

MariaDB 구문 오류

starjava 2023. 10. 19. 21:49
반응형

MariaDB 구문 오류

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

어떻게 고쳐야 할지 모르겠어요.저는 최신 xampp 버전을 사용하고 있습니다.

제거합니다.()끝나고int숫자를 포함합니다.varchar()값이 필요합니다.마지막 행의 마침표는 쉼표여야 합니다.

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)
);

여기 SQL Fiddle이 있습니다.

언급URL : https://stackoverflow.com/questions/33723031/mariadb-syntax-error

반응형