当前位置:网站首页>【SQL】595. 大的国家
【SQL】595. 大的国家
2022-08-09 14:58:00 【漆黑丶】
题目:
World 表:
±------------±--------+
| Column Name | Type |
±------------±--------+
| name | varchar |
| continent | varchar |
| area | int |
| population | int |
| gdp | int |
±------------±--------+
name 是这张表的主键。
这张表的每一行提供:国家名称、所属大陆、面积、人口和 GDP 值。
如果一个国家满足下述两个条件之一,则认为该国是 大国 :
面积至少为 300 万平方公里(即,3000000 km2),或者
人口至少为 2500 万(即 25000000)
编写一个 SQL 查询以报告 大国 的国家名称、人口和面积。
按 任意顺序 返回结果表。
查询结果格式如下例所示。
示例:
输入:
World 表:
±------------±----------±--------±-----------±-------------+
| name | continent | area | population | gdp |
±------------±----------±--------±-----------±-------------+
| Afghanistan | Asia | 652230 | 25500100 | 20343000000 |
| Albania | Europe | 28748 | 2831741 | 12960000000 |
| Algeria | Africa | 2381741 | 37100000 | 188681000000 |
| Andorra | Europe | 468 | 78115 | 3712000000 |
| Angola | Africa | 1246700 | 20609294 | 100990000000 |
±------------±----------±--------±-----------±-------------+
输出:
±------------±-----------±--------+
| name | population | area |
±------------±-----------±--------+
| Afghanistan | 25500100 | 652230 |
| Algeria | 37100000 | 2381741 |
±------------±-----------±--------+
答案:
# Write your MySQL query statement below
select name, population, area
from World
where area>=3000000 or population>=25000000
边栏推荐
猜你喜欢
随机推荐
【深度学习】梳理凸优化问题(五)
smote 采样
【The sword refers to Offer II 091. Paint the house】
基于MTCNN和FaceNet的实时人脸检测识别系统
【研究生工作周报】(第五周)
tensor转cv::Mat(即CHW转HWC)原理含C#代码实现
基于MySQL的数据在线管理系统
《身体是革命的本钱,该注意时还是要注意!》
MNIST数据集的训练(内附完整代码及其注释)
hugging face tutorial - Chinese translation - sharing custom model
封装仿支付宝密码输入效果
如何选择可靠的亚马逊代运营
单例模式-五种方式 不要被克隆
深入浅出最优化(8) 拉格朗日乘子法
【工具使用】Modscan32软件使用详解
Region实战SVG地图点击
UDP 基本通信框架
【Postgraduate Work Weekly】(Week 7)
【 Leetcode 】 433. The smallest genetic changes
spark shuffle








