|
A constraint that is a key used to link two tables together
Uma restrição que é uma chave usada para ligar duas tabelas juntas
The following SQL creates a FOREIGN KEY on the "PersonID" column when the "Orders" table is created:
O seguinte SQL cria uma FOREIGN KEY na coluna "PersonID" quando a tabela "Orders" é criada:
CREATE TABLE Orders (
OrderID int NOT NULL,
OrderNumber int NOT NULL,
PersonID int,
PRIMARY KEY (OrderID),
FOREIGN KEY (PersonID)
REFERENCES Persons(PersonID)
ON UPDATE RESTRICT
ON DELETE CASCADE
);
|
|