请大家帮忙看看我写的这个ORACLE查询有什么问题!!跪谢了!# Database - 数据库
a*g
1 楼
查询涉及两个表:account(A#,cname,bname,bal), branch(bname,assets,bcity)
查询要求 print the name of all customers who have an account at every branch
in “Edina” where “James” does not have an account.
我的代码如下(老师说是错误的,结果对但代码表达的意思不对)
SELECT distinct cname
FROM account
WHERE bname
IN
(SELECT bname
FROM branch
WHERE lower(bcity) = 'edina')
MINUS
SELECT distinct cname
FROM account
WHERE bname
IN
(SELECT distinct account.bname
FROM account, branch
WHERE lower(cname) = 'james'
And lower(bcity)='edina');
后来我又换思路,改了一个
查询要求 print the name of all customers who have an account at every branch
in “Edina” where “James” does not have an account.
我的代码如下(老师说是错误的,结果对但代码表达的意思不对)
SELECT distinct cname
FROM account
WHERE bname
IN
(SELECT bname
FROM branch
WHERE lower(bcity) = 'edina')
MINUS
SELECT distinct cname
FROM account
WHERE bname
IN
(SELECT distinct account.bname
FROM account, branch
WHERE lower(cname) = 'james'
And lower(bcity)='edina');
后来我又换思路,改了一个