gpt4 book ai didi

MySQL更新另一列的md5

转载 作者:行者123 更新时间:2023-11-30 22:18:06 27 4
gpt4 key购买 nike

我需要执行一个更新查询,从我的谷歌日历列中生成一个 md5 散列。这是我的查询:

UPDATE `ea_appointments` SET `hash` = MD5(`id_google_calendar`)

做这样的东西行吗?:

Table: ea_appointments
id_google_calendar Hash
e5e3were760lkj792c7t5vm61bvk_20160729T200000Z d5f9f4ef02e438d49c8bf39cd4b4118d

最佳答案

是的,它会成功的。您可以通过以下方式粗略地检查它:

select md5('test');

结果:

+----------------------------------+
| md5('test') |
+----------------------------------+
| 098f6bcd4621d373cade4e832627b4f6 |
+----------------------------------+

或者:

select md5('e5e3were760lkj792c7t5vm61bvk_20160729T200000Z');

结果:

+------------------------------------------------------+
| md5('e5e3were760lkj792c7t5vm61bvk_20160729T200000Z') |
+------------------------------------------------------+
| 06b5a13d9a7b0ed26ab1406434954972 |
+------------------------------------------------------+

或者:

create table t(id_google_calendar varchar(100), hash varchar(100));
insert into t values ('e5e3were760lkj792c7t5vm61bvk_20160729T200000Z', '');
update t set Hash = md5(id_google_calendar);
select * from t;

结果:

+-----------------------------------------------+----------------------------------+
| id_google_calendar | hash |
+-----------------------------------------------+----------------------------------+
| e5e3were760lkj792c7t5vm61bvk_20160729T200000Z | 06b5a13d9a7b0ed26ab1406434954972 |
+-----------------------------------------------+----------------------------------+

关于MySQL更新另一列的md5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37540126/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com