gpt4 book ai didi

sql - 为什么 Oracle 数据库不适用于 as

转载 作者:行者123 更新时间:2023-12-04 21:17:01 26 4
gpt4 key购买 nike

此代码在 Oracle 中不起作用

SELECT cost
FROM
(
SELECT shoppingserviceid,cost,bsid
FROM service JOIN shopping_service
ON service.serviceid = shopping_service.serviceid
) as S
WHERE cost = 2000

但是下面这段代码有效

SELECT cost
FROM
(
SELECT shoppingserviceid,cost,bsid
FROM service JOIN shopping_service
ON service.serviceid = shopping_service.serviceid
)
WHERE cost = 2000

好吧,我是 oracle 的新手,之前我习惯用 MySQL 编写代码。 oracle中如何使用AS语句?

最佳答案

Oracle 中的表别名不使用 AS 关键字:

SELECT cost -- can also use S.cost
FROM
(
SELECT shoppingserviceid,cost,bsid
FROM service JOIN shopping_service
ON service.serviceid = shopping_service.serviceid
) S
WHERE cost = 2000 -- Can also use S.cost

关于sql - 为什么 Oracle 数据库不适用于 as,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27034073/

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