Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个名为数量的列,包含 1000 行数据。我希望 mysql 随机更改所有数量,将数量增加 10%-20%
您可以使用此更新语句
update mytable set quantity = quantity * (1.1 + rand() * 0.1)
尝试 :
UPDATE your_table SET quantity = quantity*(1.1+RAND()*.1)
边打字边生活