Publications テーブルから著者を削除し、Users と Publications をリンクする 3 番目のテーブルを作成する必要があります。
PublicationAuthors
PublicationID int
UserID int
その後、クエリでそのテーブルをチェックして、ユーザーがパブリケーションに関連付けられているかどうかを確認できます。さらに、出版物に新しい列を追加することなく、必要な数の著者を持つことができ、誰かが名前を変更しても、出版物との関係が壊れることはありません。
以下に例を示します (これには SQL Server を使用したため、構文が若干異なる場合があります)。
CREATE TABLE Publications(
[PublicationID] [int] IDENTITY(1,1) NOT NULL,
[Title] [nvarchar](128) NOT NULL,
[DatePublished] [DateTime]
PRIMARY KEY CLUSTERED
(
[PublicationID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE Authors(
[AuthorID] [int] IDENTITY(1,1) NOT NULL,
[FirstName] [nvarchar](128) NOT NULL,
[LastName] [nvarchar](128) NOT NULL
PRIMARY KEY CLUSTERED
(
[AuthorID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE PublicationAuthors(
[PublicationID] [int],
[AuthorID] [int]
PRIMARY KEY CLUSTERED
(
[PublicationID] ASC,
[AuthorID]
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
INSERT INTO Publications (Title, DatePublished) VALUES ('Sphere', '5/12/1987')
INSERT INTO Publications (Title, DatePublished) VALUES ('Jurassic Park', '11/1/1990')
INSERT INTO Authors (FirstName, LastName) VALUES ('Michael', 'Chricton')
INSERT INTO Authors (FirstName, LastName) VALUES ('Andy', 'McKenna')
INSERT INTO PublicationAuthors (PublicationID, AuthorID) VALUES (1, 1)
INSERT INTO PublicationAuthors (PublicationID, AuthorID) VALUES (2, 1)
INSERT INTO PublicationAuthors (PublicationID, AuthorID) VALUES (2, 2)
--All Authors for this Publication
SELECT p.Title, p.DatePublished, a.FirstName, a.LastName
FROM Publications p
INNER JOIN PublicationAuthors pa
ON pa.PublicationID = p.PublicationID
INNER JOIN Authors a
ON a.AuthorID = pa.AuthorID
WHERE p.PublicationID = 2
--All Publications for this Author
SELECT p.Title, p.DatePublished, a.FirstName, a.LastName
FROM Authors a
INNER JOIN PublicationAuthors pa
ON pa.AuthorID = a.AuthorID
INNER JOIN Publications p
ON pa.PublicationID = p.PublicationID
WHERE a.AuthorID = 1
次に、著者の姓のつづりを間違えたことに気付いたら、Publications テーブルに触れずにその 1 行を更新するだけで済みます。