0

I cannot figure out what the problem is with my table..

CREATE TABLE PLAYER
    (FirstName          VARCHAR(15)         NOT NULL, 
    LastName            VARCHAR(15)         NOT NULL, 
    BirthDate           DATE, 
    Address             VARCHAR(30),
    EmailAddress        VARCHAR(30)         NOT NULL,
    Sex                 CHAR,
    TeamName            VARCHAR(30)         NOT NULL,
    ClubName            VARCHAR(30)         NOT NULL,
    AgeGroup            VARCHAR(5)          NOT NULL,
    PRIMARY KEY (LastName), 
    FOREIGN KEY (TeamName)
    **);**

CREATE TABLE TEAMS
    (TeamName           VARCHAR(30)         NOT NULL,
    AgeGroup            VARCHAR(5)          NOT NULL,
    Sex                 CHAR,
    CoachFName          VARCHAR(20)         NOT NULL,
    CoachLName          VARCHAR(20),
    ClubName            VARCHAR(30)         NOT NULL,   
    PRIMARY KEY (TeamName),
    FOREIGN KEY (AgeGroup)
    **FOREIGN KEY (ClubName)** 
    );      

Below is the message I keep receiving.. I honestly have no idea how to get this table to execute! I highlighted in bold where the message said the error was near.

*Msg 102, Level 15, State 1, Line 13
Incorrect syntax near ')'.
Msg 156, Level 15, State 1, Line 24
Incorrect syntax near the keyword 'FOREIGN'.*
java seeker
  • 1,246
  • 10
  • 13

1 Answers1

1

You need to specify what table and field the foreign keys reference. For example, for the first error, you need to specify foreign key (teamname) references teams(teamname), if that is what you mean.

Warren Dew
  • 8,790
  • 3
  • 30
  • 44