sqlzoo刷题笔记-01 | SELECT from WORLD

本文提供了一组SQL查询示例,涵盖了从基础的数据选择到更复杂的条件过滤和计算。例如,找出人口超过2亿的国家,计算人均GDP,展示南美国家的人口以百万计,筛选出名称包含特定词汇的国家,以及找出人口或面积达到一定标准的国家等。这些练习旨在帮助读者掌握SQL中的SELECT语句及其与WHERE、LIKE、ROUND等操作符的结合使用。
摘要由CSDN通过智能技术生成

网址:https://sqlzoo.net/wiki/SELECT_from_WORLD_Tutorial

1、Introduction

Read the notes about this table. Observe the result of running this SQL command to show the name, continent and population of all countries.

观察运行此 SQL 命令的结果。

SELECT name, continent, population 
FROM world

2、Large Countries

How to use WHERE to filter records. Show the name for the countries that have a population of at least 200 million. 200 million is 200000000, there are eight zeros.

使用 WHERE 来筛选记录。显示人口至少为 2 亿的国家名称。

SELECT name
FROM world
WHERE population > 200000000

3、Per capita GDP

Give the name and the per capita GDP for those countries with a population of at least 200 million.

至少有2亿的国家计算人均国内生产总值。

SELECT name, gdp/population as 人均生产总值
FROM world
WHERE population > 200000000

4、South America In millions

Show the name and population in millions for the countries of the

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值