I have two tables in one SQL-database. A parent table calles dbo.tab_authors
and a child table called dbo.tab_articles
.
The tables are defined in that way:
dbo.tab_authors:
(PK) ID int
Name string
dbo.tab_articles:
(PK) ID int
Title string
(FK) Author_first int
(FK) Authors_further int
Within the dbo.tab_articles
i want to select the corresponding authors from dbo.tab_authors
. Author_first
(the first author of an arcticle) and Authors_further
(all the remaining authors) have foreign keys (FK) to primary key (FK) ID
of dbo.tab_authors
. But in Author_first
there is a 1:1 relation and in Authors_furhter
I want to install a 1:n relation to the parent table dbo.tab_authors
.
Lets assume following datasets as an example
dbo.tab_authors:
ID Name
1 Author the First
2 Author the Second
3 Author the Third
dbo.tab_articles
ID Title Author_first Authors_further
1 Important Article 1 2;3
2 More Important Article 2 1;3
3 Most Important Article 3 1;2
The question:
How to define the relationship between dbo.tab_articles.Authors_further
and dbo.tab_authors.ID
in SQL?
(I am using MS SQL Server Managment Studio 18.8)
I would appreciate any advice!