0

I need help with this it keeps giving the same error in Oracle SQL Developer.

Error starting at line : 15 in command -

CREATE TABLE B_BOOKING (
    booking_number int NOT NULL PRIMARY KEY,
    date_booked date,
    performance_order int,
    base_pay int,
    band_number int,
    concert_number int, FOREIGN KEY REFERENCES B_CONCERT(concert_number)
)

Error at Command Line : 21 Column : 34 Error report - SQL Error: ORA-00906: missing left parenthesis 00906. 00000 - "missing left parenthesis" *Cause:
*Action:

1 Answer 1

1

You appear to be trying to declare a foreign key inline and have the syntax incorrect, you want:

CREATE TABLE B_BOOKING (
    booking_number int PRIMARY KEY,
    date_booked date,
    performance_order int,
    base_pay int,
    band_number int,
    concert_number int REFERENCES B_CONCERT(concert_number)
)

Also, you do not need a NOT NULL constraint on a PRIMARY KEY column.

Alternatively you can declare the constraint as:

CREATE TABLE B_BOOKING (
    booking_number int PRIMARY KEY,
    date_booked date,
    performance_order int,
    base_pay int,
    band_number int,
    concert_number int,
    CONSTRAINT constraint_name FOREIGN KEY ( concert_number )
                               REFERENCES B_CONCERT(concert_number)
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.