Getting Error ORA-00902 - Invalid Identifier when creating a foreign key I'm using the following script to create tables:

DROP TABLE Vehicle_type;
CREATE TABLE Vehicle_type
(
Vehicle_type_id INT PRIMARY KEY,
Model VARCHAR2(15),
Make VARCHAR2(15)
);

DROP TABLE Vehicle;
CREATE TABLE Vehicle
(
Registration VARCHAR2(7) PRIMARY KEY,
FOREIGN KEY (Vehicle_type_id) REFERENCES Vehicle_type(Vehicle_type_id),
GVW INT,
Year INT,
Body VARCHAR2(15)
);


Which creates the Vehicle_type table just fine, but when it gets to the foreign key in the Vehicle table I get the error ORA-00904: "VEHICLE_TYPE_ID": invalid identifier.

It's like the Vehicle_type_id column doesn't exist, but it definitely does because it shows up in SQLDeveloper.
Your syntax is off. You need to actually define the column that has the constraint on it, and add the constraint at the end.

CREATE TABLE Vehicle
(
  Registration VARCHAR2(7) PRIMARY KEY,
  Vehicle_type_id INT,                      -- add this
  GVW INT,
  Year INT,
  Body VARCHAR2(15),
  CONSTRAINT vehicle_type_fk                -- constraint name
    FOREIGN KEY (Vehicle_type_id)           -- constrained column
    REFERENCES Vehicle_type(Vehicle_type_id)
);


Also you'll need to drop the vehicle table before the vehicle_type table, otherwise you'll get a dependency error:

ORA-02449: unique/primary keys in table referenced by foreign keys