You only need auto_increment
on the column used as the primary key in the table. Foreign keys would have the AUTO_INCREMENT
(if appropriate) in their reference tables.
So:
CREATE TABLE PropertyOffers (
OfferID INT(10) AUTO_INCREMENT,
CONSTRAINT PRIMARY KEY (OfferID),
ClientID INT(8),
AgentID INT(8),
PropertyId INT, -- or whatever the type
CONSTRAINT regstufk FOREIGN KEY (ClientID) REFERENCES Clients(ClientID),
CONSTRAINT regstufk FOREIGN KEY (AgentID) REFERENCES Agents(AgentID),
CONSTRAINT propertyoffer FOREIGN KEY (PropertyID) REFERENCES Properties(PropertyID)
);
You have a foreign key that references PropertyID
, but it is not defined in the table. You need a column before you can declare it as a foreign key.
CLICK HERE to find out more related problems solutions.