If you are using Rails and migrations add_index(:table, [:column1, :column2], :unique => true) if not something like this sql CREATE UNIQUE INDEX index_name ON table(column1,column2); Becker On Fri, Apr 11, 2008 at 2:02 PM, Dave Thomas <dave / pragprog.com> wrote: > > On Apr 11, 2008, at 3:47 PM, Phillip Gawlowski wrote: > > > Most database systems can handle that, be defining a UNIQUE constraint > > on columns. > > > > However, that means that A = 1 and B = 2 won't work. > > > > Sure it will- you define the unique index to span the two columns, and then > only non-unoque combinations of those columns will fail. > > Dave > >