I’m creating a constraing in a table so that none of 8 columns must be equal to each other. I wanted to do:
alter table mytable
add constraint no_duplicate_values
check (col_1 <> col_2 <> col__3 <> col__4 <> col__5 <> col__6 <> col__7 <> col__8);
But of course this doesn’t work because <>
only accepts two operands, left and right. Is there an elegant, single-statement alternative that’s equivalent?