查询。 1.该公司决定将福特货车的价格提高10%,而所有其他价格保持不变。为系统中的所有车辆生成新的价目表。 我做了这个代码,但它仍然给我留言。
ORA-00933:SQL命令未正确结束
Select price, type_of_vehicle, make_of_vehicle
From type of vehicle, make of vehicle
Where type_of_vehicle = 'van'
Make_of_vehicle = 'ford'
Price = Price * 1.10;
有人可以帮助找到正确的答案吗?
答案 0 :(得分:2)
这里有语法错误
From type of vehicle, make of vehicle
如果这些是您的表的真实姓名,那么您需要将它们括在引号中:
From "type of vehicle", "make of vehicle"
如果您需要更新值,正如您的作业似乎建议的那样,那么您需要执行update from。但是,您应该首先观看教程,因为您显然没有准备编写Oracle代码。
答案 1 :(得分:0)
表名中似乎有一个问题,因为它中有空格。表名中没有空格(不常见),尝试使用正确的表名(也许是......跟随)。另外,你必须在条件之后使用and
。 如果您想从数据库中检索某些信息 :(仍然不确定您的表格和结构是什么)
Select price, type_of_vehicle, make_of_vehicle
From typeOfVehicle, makeOfVehicle
Where type_of_vehicle = 'van'
and Make_of_vehicle = 'ford'
and price.VehicleId = typeOfVehicle.VehicleId
and typeOfVehicle.VehicleId = makeOfVehicle.VehicleId
编辑:
对于你想要做的事情,这就是更新你应该写的价格,如下:
update price
set price = price *1.10;
此语句将更新所有记录,以便仅更新具有来自另一个表的特定属性的记录,我需要知道表的结构以及它们的 PK 和 FK 即可。如果我了解它,我可以帮助你更多。
答案 2 :(得分:0)
你应该做一个更新功能。
UPDATE table_with_price
SET Price = (Price * 1.10)
WHERE type_of_vehicle = 'van'
AND Make_of_vehicle = 'ford'