cur.execute('insert into keywords(keywords, count) values(%s,%s)', (key, from_url_dict[key]))
{key1:10,key2:100}{key1:30,key3:100}前面是key,对应的后面是count如何让mysql插入数据的时候当存在key相同时,对应的count数值就相加?
欢迎选择我的课程,让我们一起见证您的进步~~
insert into keywords(keywords, count) values(%s,%s) ON DUPLICATE KEY UPDATE count = count +1;
insert into keywords(keywords, count) values(%s,%s) ON DUPLICATE KEY UPDATE count = count +1;