SQL查询返回异常 [英] SQL query returns exception

查看:138
本文介绍了SQL查询返回异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行以下示例: https://sqlzoo.net/wiki/SELECT_within_SELECT_Tutorial

I am running the examples to be found here: https://sqlzoo.net/wiki/SELECT_within_SELECT_Tutorial

我得到了一个名为world的表:

I am given a table named world:

在本练习中,我得到一个例外:

In this exercise I am getting an exception:

SELECT name, continent, population
FROM world 
WHERE continent IN (
    SELECT continent FROM world x
    WHERE ALL(
        SELECT population FROM world y
        WHERE x.continent = y.continent
    ) <= 25000000
)

发生异常的原因是什么,如何纠正我的代码?

What is the reason for the exception, and how can I correct my code?

推荐答案

ALL ..相比较的值必须位于ALL

Looks like the value which should ALL .. compared to must be in front of ALL

SELECT name, continent, population
FROM world 
WHERE continent IN (SELECT continent FROM world x WHERE 25000000> ALL(SELECT population FROM world y WHERE x.continent = y.continent) )

这篇关于SQL查询返回异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆