I have 1 table with 6 columns lets call them
A B C D E F
They can be null or a value but that once have a value entered in any row of any column it must be null or unique and validated by the database
what key or constraint could I use to achive this?
ok real life scenario–
I have a product this is carrots the carrot can have upto 6 barcodes values, but if i have apples the barcode must not be the same any of the barcode values of carrots. Table columns product, barcode1, barcode2, barcode3, barcode4, barcode5, barcode6.
If you are trying to enforce uniqueness across all six columns (e.g., I enter ‘Foo’ in column A for a row, then columns B,C,D,E, or F in that row cannot have ‘Foo’ nor any other row for columns A-F), there is no built-in mechanism to do this beyond triggers. I suspect that your data may not be normalized and that is likely the reason for the inability to use built-in referential mechanisms to enforce uniqueness. We would need to know more about the database schema to know for sure.
ADDITION
The normalized solution would be to store your barcodes in another table: