Problem setting Foreign key

1

I am now learning database. I do not understand why I'm not letting you set team_id as a foreign key.

    
asked by anonymous 25.11.2017 / 19:25

1 answer

0

What you lack is setting the Id column in your Team table as the primary key.

To add a primary key to a table, you can use the ALTER TABLE command.

Your syntax is:

ALTER TABLE table_name
ADD CONSTRAINT constraint_name PRIMARY KEY (column1, column2, ... column_n);

Or by SQL Developer, right-click the desired table and select the Edit menu.

SelectthePrimaryKey

Selectwhatyourprimarykeyis

AndfinallyclickOK.

References:

Oracle / PLSQL: Primary Keys . Available at: link .  Accessed on: 25 Nov. 2017.

Getting Started with Oracle SQL Developer . Available at: link . Accessed on: 25 Nov. 2017.

    
25.11.2017 / 20:16