我有一個像這些行上的Postgres:空值不是唯一的
name | address | college
john | rome |
john | rome |
max | tokyo |
我創建一個表是這樣的:
create test (
name varchar(10),
address varchar(20),
college varchar(20),
constraint test_uq unique (name,address,college);
我怎樣才能讓空值成爲唯一的,所以輸出可以是這樣的:
name | address | college
john | rome |
max | tokyo |
有關MySQL和非唯一空值的相關問題:http://stackoverflow.com/query estions/4081783/unique-key-with-nulls – osa