Skip to content
Advertisement

SQL missing parenthesis when creating a table [closed]

I’m trying to create a table for a college project, but when I run my code it tells me I am missing a left parenthesis, and I simply cannot see where.

please help code is below

create table booking (
    booking_id number 
,   booking_ref varchar2
,   booking_date date 
,   passenger_id number 
,   travel_class_code varchar2
,   flight_id number 
,   airplane_id varchar2   compound key
,   booking_status_id varchar2   compound key
,   ticket_type_code varchar2 
,   payment_method varchar2
);
    

Advertisement

Answer

You need sizes on the VARCHAR2 data types and compound key is not valid.

create table booking (
    booking_id number 
,   booking_ref varchar2(1)
,   booking_date date 
,   passenger_id number 
,   travel_class_code varchar2(1)
,   flight_id number 
,   airplane_id varchar2(1)
,   booking_status_id varchar2(1)
,   ticket_type_code varchar2(1) 
,   payment_method varchar2(1)
,   CONSTRAINT BOOKING__PK PRIMARY KEY (airplane_id, booking_status_id)
);
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement