Mysql 将产品价格提高10%

Mysql 将产品价格提高10%,mysql,sql,percentage,Mysql,Sql,Percentage,我无法将hp产品的价格提高10% 这是我尝试过的-->> 以下是产品表的图片: 这是一个更新,而不是选择,因此FROM子句不正确。此外,分号应位于最后一行的末尾 UPDATE products SET price = price*1.1; <== Remove the semicolon from products <== remove this line where prod_name like 'HP%' <== add a semicolon at the en

我无法将hp产品的价格提高10%

这是我尝试过的-->>

以下是产品表的图片:


这是一个
更新
,而不是
选择
,因此
FROM
子句不正确。此外,分号应位于最后一行的末尾

UPDATE products SET price = price*1.1;  <==  Remove the semicolon
from products  <== remove this line
where prod_name  like 'HP%'  <== add a semicolon at the end of this line

这是一个
更新
,而不是
选择
,因此
FROM
子句不正确。此外,分号应位于最后一行的末尾

UPDATE products SET price = price*1.1;  <==  Remove the semicolon
from products  <== remove this line
where prod_name  like 'HP%'  <== add a semicolon at the end of this line
这是您的查询:

UPDATE products SET price = price*1.1;
from products 
where prod_name  like 'HP%'
第二行的分号有一个问题。此外,它不是标准的SQL(尽管在某些数据库中也可以使用)。表达这一点的标准方式是:

update products
    set price = price * 1.1
    where prod_name like 'HP%';
在这种情况下,
from
子句不是必需的。

这是您的查询:

UPDATE products SET price = price*1.1;
from products 
where prod_name  like 'HP%'
第二行的分号有一个问题。此外,它不是标准的SQL(尽管在某些数据库中也可以使用)。表达这一点的标准方式是:

update products
    set price = price * 1.1
    where prod_name like 'HP%';

在这种情况下,
from
子句不是必需的。

正确的查询如下:

update products set price = price * 1.1
where prod_name like 'HP%' ;

不知道你为什么要突出东芝?是否要更新此内容?

正确的查询如下:

update products set price = price * 1.1
where prod_name like 'HP%' ;

不知道你为什么要突出东芝?您想更新吗?

那么到底是什么问题?你有错误吗?那到底是什么问题?你有错误吗?在1.1旁边加分号可以吗?哦,我没注意到。不,分号应该从第一行移到第二行的末尾。我会相应地编辑我的帖子。在1.1旁边加上分号可以吗?哦,我错过了。不,分号应该从第一行移到第二行的末尾。我将相应地编辑我的帖子。