PROMPT Creating table FLIGHT_INFO_INBOUND

CREATE TABLE flight_info_inbound (
   flight_no                     CHAR(8) NOT NULL,
   flight_date                   CHAR(5) NOT NULL,
   trip_date                     DATE NOT NULL,
   trip_number                   NUMBER DEFAULT 0 NOT NULL,
   airport_code                  CHAR(3) NOT NULL,
   schd_arrival_time             DATE,
   est_arrival_time              DATE,
   act_arrival_time              DATE,
   gate                          CHAR(5),
   terminal                      VARCHAR2(10),
   apron                         CHAR(5),
   block_off                     CHAR(1),
   aircraft_type                 VARCHAR2(10),
   aircraft_registration         VARCHAR2(20),
   prev_airport                  VARCHAR2(4),
   prev_departure_time           DATE,
   interface_id                  NUMBER NOT NULL,
   raw_data_id                   NUMBER,
   row_create_time               date,
   row_date_time                 date,
   cuser                         varchar2(30),
   muser                         varchar2(30),
   mterm                         varchar2(64),
   source                        varchar2(8),
   to_be_archived                varchar2(1),
   appn_row_id                   number(18) not null,
   system_id                     number(4) default 0 not null
);

alter table flight_info_inbound add ( constraint flight_info_inbound_pk primary key (appn_row_id) using index tablespace &1._indexes);

ALTER TABLE flight_info_inbound ADD ( CONSTRAINT flight_info_inbound_uk1 unique (flight_no,flight_date,airport_code) USING INDEX TABLESPACE &1._indexes);

ALTER TABLE flight_info_inbound ADD ( CONSTRAINT flight_info_inbound_uk2 unique (airport_code,flight_no,trip_date,trip_number) USING INDEX TABLESPACE &1._indexes);

ALTER TABLE flight_info_inbound ADD CONSTRAINT flight_info_fk_sys_interface_1 FOREIGN KEY ( interface_id) REFERENCES sys_interface( id);

CREATE INDEX flight_info_inbound_sk1 ON flight_info_inbound(interface_id) TABLESPACE &1._indexes;

COMMENT ON TABLE FLIGHT_INFO_INBOUND IS 'This table contains flight details from external systems for inbound flights';

COMMENT ON COLUMN FLIGHT_INFO_INBOUND.ACT_ARRIVAL_TIME IS  'Actual time of arrival';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.AIRCRAFT_REGISTRATION IS  'Aircraft registration';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.AIRCRAFT_TYPE IS  'Aircraft type';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.AIRPORT_CODE IS  'Airport code';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.APRON IS  'Apron';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.BLOCK_OFF IS  'Off blocks time';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.EST_ARRIVAL_TIME IS  'Estimated time of arrival';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.FLIGHT_DATE IS  'Flight date';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.FLIGHT_NO IS  'Flight number';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.GATE IS  'Gate number';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.INTERFACE_ID IS  'Interface identifier';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.PREV_AIRPORT IS  'Previous airport name';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.PREV_DEPARTURE_TIME IS  'Departure time from previous airport';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.RAW_DATA_ID IS  'Raw data identifier';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.SCHD_ARRIVAL_TIME IS  'Scheduled time of arrival';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.TERMINAL IS  'Terminal';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.TRIP_DATE IS  'Trip date';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.TRIP_NUMBER IS  'Trip number';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.CUSER IS 'The user who created the row';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN FLIGHT_INFO_INBOUND.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
