CREATE TABLE Books (
   BookID INT NOT NULL PRIMARY KEY,
   AuthorID INT NOT NULL,
   BookName VARCHAR(100) NOT NULL,
   Price MONEY  NOT NULL
)
GO

CREATE TABLE Authors (
   AuthorID INT NOT NULL PRIMARY KEY,
   Name VARCHAR(100) NOT NULL
)
GO

ALTER TABLE Books 
ADD CONSTRAINT fk_author 
FOREIGN KEY (AuthorID) 
REFERENCES Authors (AuthorID) ON DELETE CASCADE 
GO
More detail from ...
Advertisements