Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
たとえば、「男性」または「女性」の2つの可能なオプションを持つ「性別」という列のように、2つの値のみである可能性のある列を追加したい場合
使用するCHECK
CHECK
Gender VARCHAR(6) NOT NULL CHECK (Gender IN ('Male', 'Female'))
値が 0 または 1 (true/false) のみになるように、null を許可しないビット フィールド タイプを使用することをお勧めします。
create table abc ( Gender Varchar(10) check (gender in ('Female','Male'))