title: Error relate SQL Server tables
body: <p>I have the following problem: when we run the code, it displays the following error:</p>
  
  <blockquote>
    <p>There are primary keys or candidates in the reference <code>Ticket</code> table 
    that match the list of referencing columns in foreign key '
    <code>FK__Payment__PkTicke__1A14E395</code></p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>create table SystemUser
  (
      PkUser int identity(1,1),
      UserLogin nvarchar(20) not null unique,
      UserPassword nvarchar(50) not null,
      UserName nvarchar(50) not null,
      UserCpf nvarchar(50) not null,
      UserBirth datetime not null,
      UserGender nvarchar(15) not null,
      AddressCep int not null,
      AddressStreet nvarchar(50) not null,
      AddressNumber nvarchar(20) not null,
      AddressComplement nvarchar(50) not null,
      AddressCity nvarchar(50) not null,
      AddressState nvarchar(50) not null,
      primary key(PkUser)
  )
  
  create table Attractions
  (
      PkAttraction integer identity(1,1) ,
      AttractionName nvarchar(50) not null unique,
      AttractionDate datetime not null,
      AttractionDescription nvarchar(150) not null
      primary key(PkAttraction)
  )
  
  create table Ticket
  (
      PkTicket int identity(1,1),
      PkUser int not null,
      PkAttraction int not null,
      TicketPrice decimal not null,
      primary key(PkTicket, PkUser, PkAttraction),
      foreign key(PkUser) references SystemUser(PkUser),
      foreign key(PkAttraction) references Attractions(PkAttraction)
  )   
  
  create table Payment
  (
      PkPayment int identity(1,1),
      PkTicket int not null,
      Portion int not null,
      IdTransaction nvarchar(100) not null,
      Payday datetime not null,
      primary key(PkPayment, PkTicket),
      foreign key(PkTicket) references Ticket(PkTicket),
  )       
  
  create table FormPayment
  (
      PkFromPayment int identity(1,1),
      PkPayment int not null,
      ShareValue decimal not null,
      ExpirationDate datetime not null
      primary key(PkFromPayment, PkPayment),
      foreign key(PkPayment) references Payment(PkPayment),
  )
  </code></pre>