englishspacedog YouTube tutorials from Canada
MICROSOFT SQL SERVER 2008 R2 MINI-LESSON 5A
create a Pointer Table for a many-to-many relationship ... this illustrates how to design a database for a many-to-many relationship in a relational DBMS such as Microsoft SQL Server or Microsoft Access.
...
Here's the SQL commands to define the 2 Foreign Keys linking the Pointer Table to the Actor Table and to the Movie Table:
ALTER TABLE dbo.PointerT
ADD CONSTRAINT FK_PointerT_ActorID
FOREIGN KEY(ActorID) REFERENCES dbo.ActorT(ActorID)
ALTER TABLE dbo.PointerT
ADD CONSTRAINT FK_PointerT_MovieID
FOREIGN KEY(MovieID) REFERENCES dbo.MovieT(MovieID)
Here's the SQL command for the SELECT command to see the data in the Actor Table and Movie Table:
SELECT * FROM ActorT, PointerT, MovieT
WHERE ActorT.ActorID=PointerT.ActorID
AND MovieT.MovieID=PointerT.MovieID
ORDER BY ActorT.ActorID,MovieT.MovieID
Leave a comment or send a message if you wanna see more videos about SQL.