The question is self-explanatory.
Replace: works exactly like INSERT, except that if an old row in the table has the same value as a new row for a PRIMARY KEY or a UNIQUE index, the old row is deleted before the new row is inserted
So the query i'd like to run is
REPLACE INTO questions SET question = 'myquestions', category = 'mycategory', isNew = '0';
and my table is the following
CREATE TABLE questions (
id int(11) NOT NULL AUTO_INCREMENT,
question varchar(254) NOT NULL,
category varchar(254) NOT NULL,
isNew tinyint(1) NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY (category, isNew)
);
So the goal is if there is already a row with the same category AND isNew delete it before creating the new row.