Subject Enforcing uniqueness constraint on multiple columns
Author jbperez808 <>
In Firebird, is it possible to enforce a uniqueness
constraint on a combination of more than one column? Or
even a primary key that spans multiple columns? For
example: all values of Column A need not be unique, nor
all values of Column B, but their combination should always
be unique such that there can be no two rows with the same
combination of values for both A and B:

(Inv. #) (Product)
134743 Hammer
134743 Drill
144750 Wrench
144755 Drill
144750 Wrench <-- **NOT ALLOWED**

If Firebird does not have this feature, are there any
other DBMSes that do? And what are the implications of
having/not having, using/not using this feature?

I am modeling a master/detail relationship between
an invoice and its contents such that:

Invoice master table has the ff. columns:

Inv. # (PK)
Customer_Code (FK referencing customer table)

Invoice detail table has the ff. columns:

Inv. # (FK referencing Invoice master table)
Product (FK referencing Product table)

I'd like the Inv.#/Product column pair to be guaranteed

Also, is there a better way to model the invoice/items
relationship besides this?