Newbie question about UNIQUE MySQL v5.0.22
am 15.07.2007 01:54:40 von nelson.salvador
Hi all,
I need some help...
My Example:
Field: Bank Account N=BA: 12353545456
Field: Bank Account N=BA:
The n=BA must be unique but could be empty also...
What is the SQL? It's Possible?
Best Regards
PiRiCa
Re: Newbie question about UNIQUE MySQL v5.0.22
am 22.07.2007 13:04:50 von Ciaran Mcnulty
On Jul 15, 12:54 am, "nelson.salva...@gmail.com"
wrote:
> My Example:
> Field: Bank Account N=BA: 12353545456
> Field: Bank Account N=BA:
>
> The n=BA must be unique but could be empty also...
If you introduce a UNIQUE constraint on a VARCHAR field, there can
only be one row that has the empty string ("") as its value.
However, if you allow the column to be NULL, you can insert as many
NULL records as you like.
-Ciaran McNulty