595. Big Countries --- SQL related from leetcode

595. Big Countries

There is a table World

+-----------------+------------+------------+--------------+---------------+
| name            | continent  | area       | population   | gdp           |
+-----------------+------------+------------+--------------+---------------+
| Afghanistan     | Asia       | 652230     | 25500100     | 20343000      |
| Albania         | Europe     | 28748      | 2831741      | 12960000      |
| Algeria         | Africa     | 2381741    | 37100000     | 188681000     |
| Andorra         | Europe     | 468        | 78115        | 3712000       |
| Angola          | Africa     | 1246700    | 20609294     | 100990000     |
+-----------------+------------+------------+--------------+---------------+

A country is big if it has an area of bigger than 3 million square km or a population of more than 25 million.

Write a SQL solution to output big countries‘ name, population and area.

For example, according to the above table, we should output:

+--------------+-------------+--------------+
| name         | population  | area         |
+--------------+-------------+--------------+
| Afghanistan  | 25500100    | 652230       |
| Algeria      | 37100000    | 2381741      |
+--------------+-------------+--------------+

Solution:

# Write your MySQL query statement below

select name,area,population from World where area >= 3000000 or population >= 25000000;

时间: 2024-10-13 14:35:02

595. Big Countries --- SQL related from leetcode的相关文章

LeetCode解题思路:595. Big Countries

There is a table World +-----------------+------------+------------+--------------+---------------+ | name | continent | area | population | gdp | +-----------------+------------+------------+--------------+---------------+ | Afghanistan | Asia | 652

Leetcode 595. Big Countries

两种写法: 1. # Write your MySQL query statement below SELECT name,population,area FROM world WHERE area>3000000 OR population >25000000; 2. # Write your MySQL query statement below SELECT name,population,area FROM world WHERE area>3000000 UNION SELEC

595. Big Countries (Easy)

Source: https://leetcode.com/problems/big-countries/#/descriptionDescription: There is a table World +-----------------+------------+------------+--------------+---------------+ | name | continent | area | population | gdp | +-----------------+------

595. Big Countries

There is a table World +-----------------+------------+------------+--------------+---------------+ | name | continent | area | population | gdp | +-----------------+------------+------------+--------------+---------------+ | Afghanistan | Asia | 652

[LeetCode] Leetcode 题解索引 (C++/Java/Python/Sql)

全部最新的题解可以在 我的 github 上找,欢迎 star 和 watch ~ 更新中~~ 说明 这个系列的题解包括用 C++/Java/Python 写的 leetcode 上的算法题目,和 Sql 写的 leetcode 上的数据库题目. 有些题目虽然 AC 了却还没写分析,所以这次就开坑来完成. 链接: 我的 github Leetcode Algorithms Problems Leetcode Database Problems CSDN 题解索引 001.Two_Sum (Med

Union比or快 Using UNION is faster when it comes to cases like scan two different column。

problem: 595. Big Countries A country is big if it has an area of bigger than 3 million square km or a population of more than 25 million. Write a SQL solution to output big countries' name, population and area. Two obvious solutions: #OR SELECT name

hot patching

Online Patching 说明 说明:该部分内容摘自OCP 050 教材. 在Oracle 11g中提出了online patch(也叫hot patch)的特性:Hot patching允许我们在实例始终在线的情况下安装,启用或禁用一个修复补丁(fix)或者诊断补丁(diagnostic patches). 使用热补丁可以安装.启用和禁用正在运行的活动Oracle 实例上的bug 修复或诊断补丁程序.使用热补丁是可在应用热补丁程序时避免停机的建议解决方案.Oracle 提供了使用opat

TimesTen 应用层数据库缓存学习:5. 异步读写缓存

eleAsynchronous Write Through(AWT) cache group, 即TimesTen的异步写缓存.数据只允许在TimesTen中修改,然后同步到Oracle.当然,TimesTen中的数据最初是从Oracle加载而来. 对于熟悉存储的人来说,cache 分为write-through和write back.而TimesTen的AWT对应的就是存储的write-back. 由于有双向的数据流动,因此对于AWT,除了只读缓存组所需的cache agent外,还需要一个r

应付描述性弹性域 Description Flexfield

(N) AP > Setup > Flexfield > Description > Segments To define your descriptive flexfield, you define the segments that make up your descriptiveflexfield structures, and the descriptive information and validation information for each segmentin