Hii guys,
I have a small doubt . Can i create a primary key for a table like in the following example
where in the OrderID and ModelID are foreign Keys referenced from 2 different tables.
I have a small doubt . Can i create a primary key for a table like in the following example
Code:
PRIMARY KEY (OrderID, ModelID)
Code:
CREATE TABLE myTable
(
OrderID SMALLINT UNSIGNED NOT NULL,
ModelID SMALLINT UNSIGNED NOT NULL,
Description VARCHAR(40),
FOREIGN KEY(OrderID) REFERENCES order(OrderID),
FOREIGN KEY(ModelID) REFERENCES model(ModelID)
PRIMARY KEY (OrderID, ModelID)
);
Comment