[MYSQL/MARIA] 복합 UNIQUE KEY와 NULLABLE
Composite Unique key constraint with multiple null value in one of the column
예를들어 room_id와 camera_number를 복합 unique key로 설정하였다.
그리고 room_id는 nullable 하다.
그럴 경우 아래와 같이 했을 때 error가 날까?
결론 아니다.
왜?
null 은 값이 아니라 비교가 불가능 하기 때문.
테이블 구성할때 이부분을 조심해야할것 같다.
Composite Unique key constraint with multiple null value in one of the column
I have a unique key on table x with 3 column (a,b,c) where a,b,c are foreign keys and c can be null in x table. a b c - - ---- 1 1 1 1 1 2 1 1 NULL 1 1 NUll Above rows are valid on MySQL and
stackoverflow.com
https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:39951226964354
unique index with null values - Ask TOM
You Asked Hello Tom, I have this situation: With a table like create table test (id number not null, name varchar2(10) not null, source_id number); (actually the real tables have more columns, but for this question these are enough) and with this rows inse
asktom.oracle.com