更新时间:2023-12-01 12:54:34
从您对所需功能的描述来看,您似乎希望 poll_id
和 ip_address
一个唯一的对或唯一的复合.
From your description on the desired functionality, it would seem that you want poll_id
and ip_address
to be a unique pair or compound unique.
CREATE TABLE tbl_poll (
id INTEGER PRIMARY KEY AUTOINCREMENT,
poll_id STRING NOT NULL,
ip_address STRING NOT NULL,
opt STRING NULL,
CONSTRAINT 'unique_vote_per_poll_per_ip_address' UNIQUE ( poll_id, ip_address ) ON CONFLICT REPLACE
);