Hi there,I've been looking at a schema that's recently came by my way. I've to write reports using two tables.I know there's a multitude of ways to do things, however, I've never quite seen this technique. So, just wanted to ask advice.There is a table header and a table detail. Header being parent. The tables relate to performance scores but I think I may get away without going into too much detail for you as it's just a schema query.OK, the developer has used a composite primary key on the header and chosen two fields. He has chosen two of the same fields on the Detail table for that tables primary key along with one more. There is no foriegn key constraint. Please see the schema below for each. I've exluded a lot of the fields for easy reading. It's fair enough that he has used a composite primary key on the header, I just don't understand the logic of the same fields in both tables being primary keys. Can someone help me understand this? Am I missing something? The developer is not available for a while for me to discuss this. Any help would be excellent... thanksHeader::CREATE TABLE [dbo].[tblSRVHeader]( [intInspectionNbr] [int] NOT NULL, [intSiteID] [int] NOT NULL, [strSiteDesc] [varchar](100) COLLATE Latin1_General_CI_AS NULL, [intProjectMgrID] [int] NULL, [strProjectMgr] [varchar](100) COLLATE Latin1_General_CI_AS NULL, CONSTRAINT [PK_tblSRVHeader] PRIMARY KEY CLUSTERED ( [intInspectionNbr] ASC, [intSiteID] ASC) ON [PRIMARY]) ON [PRIMARY]
Detail::CREATE TABLE [dbo].[tblSRVDetails]( [intInspectionNbr] [int] NOT NULL, [intSiteID] [int] NOT NULL, [intlineID] [int] IDENTITY(1,1) NOT NULL, [intDivisionID] [int] NULL, CONSTRAINT [PK_tblSRVDetails] PRIMARY KEY CLUSTERED ( [intInspectionNbr] ASC, [intSiteID] ASC, [intlineID] ASC) ON [PRIMARY]) ON [PRIMARY]