﻿CREATE TABLE [dbo].[FiltroStati] (
    [username] NVARCHAR (50) NOT NULL,
    [idxStato] INT           NOT NULL,
    CONSTRAINT [PK_FiltroStati] PRIMARY KEY CLUSTERED ([username] ASC, [idxStato] ASC),
    CONSTRAINT [FK_FiltroStati_AnagStati] FOREIGN KEY ([idxStato]) REFERENCES [dbo].[AnagStati] ([idxStato]) ON DELETE CASCADE ON UPDATE CASCADE
);


GO
CREATE NONCLUSTERED INDEX [i_username]
    ON [dbo].[FiltroStati]([username] ASC);

