gpt4 book ai didi

INSERT INTO SET 的 mysql 语法

转载 作者:行者123 更新时间:2023-11-29 06:49:28 29 4
gpt4 key购买 nike

我尝试使用以下语法插入:

INSERT  INTO salon_vendor_purchase_products(invoice_num, product_id, quantity, price) SET (\'65786\', 1, 1, 700), (\'65786\', 2, 1, 900), (\'65786\', 3, 1, 1700)

但不断收到以下错误:

sqlMessage: 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'SET (\'65786\', 1, 1, 700), (\'65786\', 2, 1, 900), (\'65786\', 3, 1, 1700)\' at line 1',

最佳答案

我们使用set来更新表或更改表。要设置值,请使用以下命令:

INSERT  INTO salon_vendor_purchase_products values(65786, 1, 1, 700) ; 
INSERT INTO salon_vendor_purchase_products values(65786, 2, 1, 900);
INSERT INTO salon_vendor_purchase_products values(65786, 3, 1, 1700);

Just for further information

假设您要将产品id 1的价格从700修改(更新)为750;在这种情况下,您必须使用与更新相反的关键字集。查询如下:

UPDATE salon_vendor_purchase_products
SET price= 750
WHERE product_id = 1;

关于INSERT INTO SET 的 mysql 语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48065515/

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