CREATE TABLE [dbo].[Country.cat]( [Country_iD] [smallint] NOT NULL, [FIPS] [char](2) NULL, [Country] [varchar](64) NOT NULL, [Continent] [char](3) NOT NULL, CONSTRAINT [PK_Country_iD] PRIMARY KEY CLUSTERED ( [Country_iD] ASC )
CREATE TABLE [dbo].[Entity.cat]( [Country_iD] [smallint] NOT NULL, [Entity_iD] [smallint] NOT NULL, [Entity] [varchar](32) NOT NULL, CONSTRAINT [PK_Entity_iD] PRIMARY KEY CLUSTERED ( [Pais_iD] ASC, [Entity_iD] ASC ) ... -- I deleted default properties for simplify sampleGO... -- more default code and ALTER TABLE [dbo].[Entity.cat] WITH CHECK ADD CONSTRAINT [FK_Entity_Country_iD] FOREIGN KEY([Country_iD]) REFERENCES [dbo].[Country.cat] ([Country_iD])GO ALTER TABLE [dbo].[Entity.cat] CHECK CONSTRAINT [FK_Entity_Country_iD]GO
CONSTRAINT [PK_Entity_iD] PRIMARY KEY CLUSTERED ([Country_iD] ASC,[Entity_iD] ASC)
CREATE TABLE [dbo].[city.cat]( [Country_iD] [smallint] NOT NULL, [Entity_iD] [smallint] NOT NULL, [City_iD] [smallint] NOT NULL, [City] [varchar](64) NOT NULL, CONSTRAINT [PK_City_iD] PRIMARY KEY CLUSTERED ( [Country_iD] ASC, [Entity_iD] ASC, [City_iD] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GOSET ANSI_PADDING OFFGOALTER TABLE [dbo].[City.cat] WITH CHECK ADD CONSTRAINT [Fk_City_Entity_iD] FOREIGN KEY([Country_iD],[Entity_iD])REFERENCES [dbo].[Entity.cat] ([Country_iD],[Entity_iD])GOALTER TABLE [dbo].[City.cat] CHECK CONSTRAINT [Fk_City_Entity_iD]GO
CityID CityName State_Region CountryID 1 Dallas Texas 1 (USA) 2 Dallas Morayshire 2 (Scotland)
CityID CityName State_RegionID CountryID 1 Dallas 1 (Texas) 1 (USA) 2 Dallas 2 (Morayshire) 2 (Scotland)