I have been looking for the answer to the question below:
MySQL: Insert record if not exists in table
I have an extra question to the accepted answer. However, I don't have enough reputation to comment on the page...
In the answer, Mike create the table like this:
CREATE TABLE `table_listnames` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`address` varchar(255) NOT NULL,
`tele` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
Is InnoDB a must, according to the query issued below? (also quoted from the answer)
INSERT INTO table_listnames (name, address, tele)
SELECT * FROM (SELECT 'John', 'Doe', '022') AS tmp
WHERE NOT EXISTS (
SELECT name FROM table_listnames WHERE name = 'John'
) LIMIT 1;
Thanks.