SQLZOO刷题记录2——SELECT from WORLD Tutorial

题目5:France, Germany, Italy

Show the name and population for France, Germany, Italy

解题5:

SELECT name, population
FROM world
WHERE name IN ('France', 'Germany', 'Italy')

 注意:函数IN的用法,括号(),()内部字符串加引号。

题目8:

Exclusive OR (XOR). Show the countries that are big by area (more than 3 million) or big by population (more than 250 million) but not both. Show name, population and area.

  • Australia has a big area but a small population, it should be included.
  • Indonesia has a big population but a small area, it should be included.
  • China has a big population and big area, it should be excluded.
  • United Kingdom has a small population and a small area, it should be excluded.

解题8:

SELECT name, population, area 
FROM world 
WHERE (area > 3000000) ^ (population > 250000000) 

注意:异或属于位运算符,条件语句的值为true或false,符合要求。

题目9:

Show the name and population in millions and the GDP in billions for the countries of the continent 'South America'. Use the ROUND function to show the values to two decimal places.

For South America show population in millions and GDP in billions both to 2 decimal places.

Millions and billions

Divide by 1000000 (6 zeros) for millions. Divide by 1000000000 (9 zeros) for billions.

解题9:

SELECT name, ROUND(population/1000000,2) AS population, ROUND(gdp/1000000000,2) AS GDP 
FROM world 
WHERE continent='South America' 

注意:ROUND(f,p) returns f rounded to p decimal places.

题目12:

The capital of Sweden is Stockholm. Both words start with the letter 'S'.

Show the name and the capital where the first letters of each match. Don't include countries where the name and the capital are the same word.

  • You can use the function LEFT to isolate the first character.
  • You can use <> as the NOT EQUALS operator.

解题12:

SELECT name, capital 
FROM world 
WHERE LEFT(name,1) = LEFT(capital,1) 
AND name <> capital

题目13:

Equatorial Guinea and Dominican Republic have all of the vowels (a e i o u) in the name. They don't count because they have more than one word in the name.

Find the country that has all the vowels and no spaces in its name.

  • You can use the phrase name NOT LIKE '%a%' to exclude characters from your results.
  • The query shown misses countries like Bahamas and Belarus because they contain at least one 'a'

解题13:

SELECT name
FROM world
WHERE name LIKE '%a%' 
AND name LIKE '%e%' 
AND name LIKE '%i%' 
AND name LIKE '%o%' 
AND name LIKE '%u%' 
AND name NOT LIKE '% %' 

 注意:这道题目提交的结果是正确的,但是感觉不够严谨,应该可以做到更加优化。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
FLUENT 2020R2 tutorial guide PDF及案例源文件 1.What’s In This Manual The ANSYS Fluent Tutorial Guide contains a number of tutorials that teach you how to use ANSYS Flu- ent to solve different types of problems. In each tutorial, features related to problem setup and postpro- cessing are demonstrated. 2. How To Use This Manual Depending on your familiarity with computational fluid dynamics and the ANSYS Fluent software, you can use this tutorial guide in a variety of ways. 2.1. For the Beginner If you are a beginning user of ANSYS Fluent you should first read and solve Tutorial 1, in order to fa- miliarize yourself with the interface and with basic setup and solution procedures.You may then want to try a tutorial that demonstrates features that you are going to use in your application. You may want to refer to other tutorials for instructions on using specific features, such as custom field functions, mesh scaling, and so on, even if the problem solved in the tutorial is not of particular interest to you. 2.2. For the Experienced User If you are an experienced ANSYS Fluent user, you can read and/or solve the tutorial(s) that demonstrate features that you are going to use in your application. You may want to refer to other tutorials for instructions on using specific features, such as custom field functions, mesh scaling, and so on, even if the problem solved in the tutorial is not of particular interest to you. 3.Typographical Conventions Used In This Manual Several typographical conventions are used in this manual’s text to help you find commands in the user interface. • Different type styles are used to indicate graphical user interface items and text interface items. For example: Iso-Surface dialog box surface/iso-surface text command

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值