我正在尝试在 sql 中创建一个 table,但我缺少一个关键字,无法找出如何修复它

I am trying to create a table in sql, but im missing a keyword, cant find out how to fix it

我正在尝试在 SQL 中创建一个 table,但我缺少一个关键字,而且我不知道如何修复它:

CREATE TABLE Attendance_of_employee
(
  supervisior VARCHAR(30) DEFAULT 'NONE',
  arrival double NOT NULL,
  shift_end double NOT NULL,
  date_time DATE NOT NULL,
  worked_hours INT NOT NULL,
  ID_record VARCHAR(30) NOT NULL,
  employeeID INT NOT NULL,
  PRIMARY KEY (ID_record),
  FOREIGN KEY (employeeID) REFERENCES EmployeeTAB(employeeID)
);

Error report -
SQL Error: ORA-00905: chýbajúce kľúčové slovo
00905. 00000 -  "missing keyword"
*Cause:    
*Action:

在 Oracle 中,您通常使用 number 表示数值,使用 varchar2() 表示字符串。我总是让主键成为 table 中的第一列。所以:

CREATE TABLE Attendance_of_employee (
  ID_record VARCHAR2(30) NOT NULL,
  supervisior VARCHAR2(30) DEFAULT 'NONE',
  arrival number NOT NULL,
  shift_end number NOT NULL,
  date_time DATE NOT NULL,
  worked_hours INT NOT NULL,
  employeeID INT NOT NULL,
  PRIMARY KEY (ID_record),
  FOREIGN KEY (employeeID) REFERENCES EmployeeTAB(employeeID)
);

Here在Rextester中是一个link(没有外键关系,因为EmployeeTAB没有定义)

使用双精度而不是双精度。

CREATE TABLE Attendance_of_employee( supervisior VARCHAR(30) DEFAULT 'NONE', 
arrival double precision NOT NULL, 
shift_end double precision NOT NULL, date_time DATE NOT NULL, 
worked_hours INT NOT NULL, 
ID_record VARCHAR(30) NOT NULL, employeeID INT NOT NULL, PRIMARY KEY (ID_record), 
FOREIGN KEY (employeeID) REFERENCES EmployeeTAB(employeeID) );