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      |
+--------------+-------------+--------------+

My solution:

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

原文地址:https://www.cnblogs.com/chenwong/p/8502898.html

时间: 2024-11-15 01:17:30

595. Big Countries的相关文章

595. Big Countries --- SQL related from leetcode

595. Big Countries There is a table World +-----------------+------------+------------+--------------+---------------+ | name | continent | area | population | gdp | +-----------------+------------+------------+--------------+---------------+ | Afgha

LeetCode解题思路:595. Big Countries

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

595. Big Countries (Easy)

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

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

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

Countries

Countries 题目链接:http://hihocoder.com/problemset/problem/1391 预处理+双指针 首先将A->B,B->A的导弹全部转化为B->A的导弹(因为不需要计算B承受的伤害,所以对于A->B的导弹,只需记录被B的防护罩返回来的导弹即可). 然后对于每个导弹计算将其反弹回B,A所需要的最小的防护罩区间[l,r](这个操作在O(1)的时间完成,画张图就很好推了) 于是问题就转化为了: 数轴上有一些固定区间,每个固定区间都有一个权值,现在有一

POJ 3114 Countries in War 强连通+最短路

用floyd超时了...注定的事情...题意:看案例就跑出来了..不需要看题了把.. #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; #include<vector> const int INF =1999299; int minn(int a,int b) { return a>b?b:a; } #define N 510 #define M

hihoCoder 1391 Countries 【预处理+排序+堆】 (ACM-ICPC国际大学生程序设计竞赛北京赛区(2016)网络赛)

#1391 : Countries 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 There are two antagonistic countries, country A and country B. They are in a war, and keep launching missiles towards each other. It is known that country A will launch N missiles. The i-th miss

基于小脚丫的ADC081S101 电压采集595数码管显示

RTL结构图 采集模块运用SPI 通讯 MISO方式收集数据 module ad_collect(input sddata,input rst_n,output reg cs,output reg sclk,input clk,output [7:0]seg_data,output done); reg [7:0]cnt;reg[4:0]state;reg[7:0]data;reg rdone; [email protected](posedge clk or negedge rst_n ) b