-1

I have a composite primary key with the attributes: (departure_airport, arrival_airport) and I was wondering if there is some kind of constraint to make sure the departure_airport is not the same with the arrival_airport?

Diana
  • 363
  • 2
  • 8
  • This kind of question might be better asked on sister site DBA.StackExchange.com – Basil Bourque Jan 11 '20 at 02:37
  • What version of what DBMS? – philipxy Jan 11 '20 at 05:48
  • When you were researching & you read any introduction whatsoever to constraints, what seemed relevant? Before considering posting please always google any error message or many clear, concise & precise phrasings of your question/problem/goal, with & without your particular strings/names & site:stackoverflow.com & tags, & read many answers. If you post a question, use one phrasing as title. See [ask] & the voting arrow mouseover texts. – philipxy Jan 11 '20 at 05:56

1 Answers1

1

Being a composite key is irrelevant.

You need to apply a CHECK constraint or write a trigger that compares the two fields for equality.

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154