clear markdown compare help best fiddles feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3601414 fiddles created (47998 in the last week).

CREATE TABLE tran_term_taxonomy(id int, taxonomy varchar(20) default 'post_tag', description varchar(20) default '');
 hidden batch(es)


insert into tran_term_taxonomy (id) values (1),(2),(3),(4)
 hidden batch(es)


select * from tran_term_taxonomy
id taxonomy description
1 post_tag
2 post_tag
3 post_tag
4 post_tag
 hidden batch(es)


create table good_keywords (keyword varchar(20))
 hidden batch(es)


insert into good_keywords values ('keyword 1'), ('keyword 2'), ('keyword 3')
 hidden batch(es)


select * from good_keywords
keyword
keyword 1
keyword 2
keyword 3
 hidden batch(es)


UPDATE `tran_term_taxonomy` SET `description` = ( SELECT keyword FROM `good_keywords` WHERE NOT EXISTS (SELECT * FROM (SELECT * FROM `tran_term_taxonomy`) t WHERE description = keyword) ORDER BY RAND() LIMIT 1 ) WHERE `tran_term_taxonomy`.`taxonomy` = 'post_tag' AND `tran_term_taxonomy`.`description` = '' LIMIT 1
 hidden batch(es)


select * from tran_term_taxonomy
id taxonomy description
1 post_tag keyword 1
2 post_tag
3 post_tag
4 post_tag
 hidden batch(es)


UPDATE `tran_term_taxonomy` SET `description` = ( SELECT keyword FROM `good_keywords` WHERE NOT EXISTS (SELECT * FROM (SELECT * FROM `tran_term_taxonomy`) t WHERE description = keyword) ORDER BY RAND() LIMIT 1 ) WHERE `tran_term_taxonomy`.`taxonomy` = 'post_tag' AND `tran_term_taxonomy`.`description` = '' LIMIT 1
 hidden batch(es)


select * from tran_term_taxonomy
id taxonomy description
1 post_tag keyword 1
2 post_tag keyword 2
3 post_tag
4 post_tag
 hidden batch(es)


UPDATE `tran_term_taxonomy` SET `description` = ( SELECT keyword FROM `good_keywords` WHERE NOT EXISTS (SELECT * FROM (SELECT * FROM `tran_term_taxonomy`) t WHERE description = keyword) ORDER BY RAND() LIMIT 1 ) WHERE `tran_term_taxonomy`.`taxonomy` = 'post_tag' AND `tran_term_taxonomy`.`description` = '' LIMIT 1
 hidden batch(es)


select * from tran_term_taxonomy
id taxonomy description
1 post_tag keyword 1
2 post_tag keyword 2
3 post_tag keyword 3
4 post_tag
 hidden batch(es)


UPDATE `tran_term_taxonomy` SET `description` = ( SELECT keyword FROM `good_keywords` WHERE NOT EXISTS (SELECT * FROM (SELECT * FROM `tran_term_taxonomy`) t WHERE description = keyword) ORDER BY RAND() LIMIT 1 ) WHERE `tran_term_taxonomy`.`taxonomy` = 'post_tag' AND `tran_term_taxonomy`.`description` = '' LIMIT 1
 hidden batch(es)


select * from tran_term_taxonomy
id taxonomy description
1 post_tag keyword 1
2 post_tag keyword 2
3 post_tag keyword 3
4 post_tag
 hidden batch(es)