SQL ORACLE需要帮助 -

时间:2017-07-05 15:30:42

标签: sql oracle

SQL>

CREATE TABLE Loan(
    Loan_ID NUMBER (5)
    CONSTRAINT  pk_Loan primary key,
    Start_Date DATE NOT NULL,
    End_Date DATE NOT NULL,
    Copy_ID NUMBER(5),
    CONSTRAINT fk_Copy_ID references Copy (Copy_ID),
    customer_ID NUMBER(5),
    CONSTRAINT fk_customer_ID references Customers (Customer_ID),
   Evaluation NUMBER(1) NOT NULL,
   check (Evaluation>=0 and Evaluation<=5>);
CONSTRAINT fk_Copy_ID references Copy (Copy_ID),
                                  *

第7行的错误: ORA-00907:缺少右括号

1 个答案:

答案 0 :(得分:0)

请试试这个:

CREATE TABLE Loan(
    Loan_ID NUMBER (5)
    CONSTRAINT  pk_Loan primary key,
    Start_Date DATE NOT NULL,
    End_Date DATE NOT NULL,
    Copy_ID NUMBER(5),
    customer_ID NUMBER(5),
    Evaluation NUMBER(1) NOT NULL,
    CONSTRAINT fk_Copy_ID foreign key (copy_id) references Copy (Copy_ID),
    CONSTRAINT fk_customer_ID foreign key (customer_id) references Customers (Customer_ID),
    constraint chk_evaluation check (Evaluation>=0 and evaluation<=5) );