所以我正在编写这段代码并且它一直给我错误:错过右括号。我找不到它还是什么?我有其他代码看起来像这样并且工作,但由于某种原因,这不是想要通过。它说它发生在我的代码的第2行.......
SQL代码:
CREATE TABLE MOVIES
(title_id NUMBER (10) NOT NULL UNIQUE,
title VARCHAR2 (60) NOT NULL,
description VARCHAR2 (400) NOT NULL,
rating VARCHAR2 (4) CHECK (rating= 'G','PG','PG13','R'),
category VARCHAR2 (20) CHECK (category= 'DRAMA','COMEDY','ACTION','CHILD','SCIFI','DOCUMENTARY'),
release_date NOT NULL),
PRIMARY KEY (title_id));
答案 0 :(得分:1)
您的代码中有几处错误。
release_date
列后的不需要的括号和缺少的数据类型=
的值列表,但需要使用
IN
试试这个
CREATE TABLE MOVIES
(
title_id NUMBER (10) NOT NULL, -- unique key will be overridden by the Primary key
title VARCHAR2 (60) NOT NULL,
description VARCHAR2 (400) NOT NULL,
rating VARCHAR2 (4) CHECK (rating IN ( 'G', 'PG', 'PG13', 'R')), -- Should be IN instead of =
category VARCHAR2 (20) CHECK (category IN ( 'DRAMA', 'COMEDY', 'ACTION', 'CHILD', 'SCIFI', 'DOCUMENTARY')), -- Should be IN instead of =
release_date timestamp NOT NULL, -- Unwanted close parenthesis and missing datatype
PRIMARY KEY (title_id)
);