Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MySQL嵌套选择X和Y_Mysql_Select - Fatal编程技术网

MySQL嵌套选择X和Y

MySQL嵌套选择X和Y,mysql,select,Mysql,Select,所以我试图进入MySQL,我正在做SQLZoo教程 有一个练习介绍了一些新技术(来自world x和world y)——x和y在这里做什么 有人能帮我把代码一行一行地分解一下吗? 谢谢你的帮助。提前谢谢 SELECT continent, name, population FROM world x WHERE population >= ALL (SELECT population FROM world y WHERE y.continent=x.contine

所以我试图进入MySQL,我正在做SQLZoo教程

有一个练习介绍了一些新技术(来自world x和world y)——x和y在这里做什么

有人能帮我把代码一行一行地分解一下吗? 谢谢你的帮助。提前谢谢

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

这是别名。在本例中,x.Continental与world.Continental相同。
但在子查询中,y.contintent与wordl.continent是相同的。使用别名,您可以加入同一个表

这是别名。在本例中,x.Continental与world.Continental相同。
但在子查询中,y.contintent与wordl.continent是相同的。使用别名,您可以加入同一个表

这是别名。在本例中,x.Continental与world.Continental相同。
但在子查询中,y.contintent与wordl.continent是相同的。使用别名,您可以加入同一个表

这是别名。在本例中,x.Continental与world.Continental相同。
但在子查询中,y.contintent与wordl.continent是相同的。使用别名,您可以加入同一个表

x
y
是您的结果集的有效名称,因此可以引用它们,而不会产生任何歧义


类似地,如果您对两个列名称相同的表(例如
customer
表和
order
表,这两个表都有
id\u customer
字段)执行
JOIN
,您将引用表名,然后是列名(例如,
order.id\u customer
,明确说明您不是指
customer.id\u customer

x
y
是结果集的有效名称,因此可以毫无歧义地引用它们


类似地,如果您对两个列名称相同的表(例如
customer
表和
order
表,这两个表都有
id\u customer
字段)执行
JOIN
,您将引用表名,然后是列名(例如,
order.id\u customer
,明确说明您不是指
customer.id\u customer

x
y
是结果集的有效名称,因此可以毫无歧义地引用它们


类似地,如果您对两个列名称相同的表(例如
customer
表和
order
表,这两个表都有
id\u customer
字段)执行
JOIN
,您将引用表名,然后是列名(例如,
order.id\u customer
,明确说明您不是指
customer.id\u customer

x
y
是结果集的有效名称,因此可以毫无歧义地引用它们

类似地,如果您对两个列名称相同的表(例如
customer
表和
order
表,这两个表都有
id\u customer
字段)执行
JOIN
,您将引用表名,然后是列名(例如,
order.id\u customer
,明确表示您不是指
customer.id\u customer