sqlzoo

您所在的位置:网站首页 greece首都英文 sqlzoo

sqlzoo

2024-01-15 02:00| 来源: 网络整理| 查看: 265

文章目录 1 SELECT names1. 找出以 Y 為開首的國家。2. 找出以 Y 為結尾的國家。3. 找出所有國家,其名字包括字母x。4. 找出所有國家,其名字以 land 作結尾。5. 找出所有國家,其名字以 C 作開始,ia 作結尾。6. 找出所有國家,其名字包括字母oo。7. 找出所有國家,其名字包括三個或以上的a。8. 找出所有國家,其名字以t作第二個字母。9. 找出所有國家,其名字都有兩個字母 o,被另外兩個字母相隔着。10. 找出所有國家,其名字都是 4 個字母的。11. 顯示所有國家名字,其首都和國家名字是相同的。12. 顯示所有國家名字,其首都是國家名字加上”City”。13. 找出所有首都和其國家名字,而首都要有國家名字中出現。14. 找出所有首都和其國家名字,而首都是國家名字的延伸。15. 顯示國家名字,及其延伸詞,如首都是國家名字的延伸。

1 SELECT names

主要是学习 LIKE 来查询字符串

符号含义_ 下划线1个字符% 百分号0个以上字符 1. 找出以 Y 為開首的國家。 英文版

You can use WHERE name LIKE ‘B%’ to find the countries that start with “B”. The % is a wild-card it can match any characters

Find the country that start with Y

中文版

你可以用WHERE name LIKE 'B%'來找出以 B 為開首的國家。 %是萬用字元,可以用代表任何字完。

找出以 Y 為開首的國家。

SELECT `name` FROM world WHERE `name` LIKE 'Y%' 2. 找出以 Y 為結尾的國家。 英文版

Find the countries that end with y

中文版

找出以 Y 為結尾的國家。

SELECT `name` FROM world WHERE `name` LIKE '%Y' 3. 找出所有國家,其名字包括字母x。 英文版

Luxembourg has an x - so does one other country. List them both.

Find the countries that contain the letter x

中文版

“Luxembourg 盧森堡”中有一個x字母,還有一個國家的名字中有x。列出這兩個國家。

找出所有國家,其名字包括字母x。

SELECT `name` FROM world WHERE `name` LIKE '%x%' 4. 找出所有國家,其名字以 land 作結尾。 英文版

Iceland, Switzerland end with land - but are there others?

Find the countries that end with land

中文版

“Iceland 冰島”和“Switzerland 瑞士”的名字都是以”land”作結束的。還有其他嗎?

找出所有國家,其名字以 land 作結尾。

SELECT `name` FROM world WHERE `name` LIKE '%land' 5. 找出所有國家,其名字以 C 作開始,ia 作結尾。 英文版

Columbia starts with a C and ends with ia - there are two more like this.

Find the countries that start with C and end with ia

中文版

“Columbia 哥倫比亞”是以 C 作開始,ia 作結尾的。還有兩個國家相同。 出所有國家,其名字以 C 作開始,ia 作結尾。

SELECT `name` FROM world WHERE `name` LIKE 'C%ia' 6. 找出所有國家,其名字包括字母oo。 英文版

Greece has a double e - who has a double o? Find the country that has oo in the name

中文版

“Greece 希臘”中有雙 e 字。哪個國家有雙 o 字呢?

找出所有國家,其名字包括字母oo。

SELECT `name` FROM world WHERE `name` LIKE '%oo%' 7. 找出所有國家,其名字包括三個或以上的a。 英文版

Bahamas has three a - who else? Find the countries that have three or more a in the name

中文版

“Bahamas 巴哈馬”中有三個 a,還有嗎?

找出所有國家,其名字包括三個或以上的a。

SELECT `name` FROM world WHERE `name` LIKE '%a%a%a%' 8. 找出所有國家,其名字以t作第二個字母。 英文版

India and Angola have an n as the second character. You can use the underscore as a single character wildcard.

SELECT `name` FROM world WHERE `name` LIKE '_n%' ORDER BY `name`

Find the countries that have “t” as the second character.

中文版

“India 印度”和”Angola 安哥拉”的第二個字母都是 n。你可以用底線符_當作單一個字母的萬用字元。

找出所有國家,其名字以t作第二個字母。

SELECT `name` FROM world WHERE `name` LIKE '_t%' 9. 找出所有國家,其名字都有兩個字母 o,被另外兩個字母相隔着。 英文版

Lesotho and Moldova both have two o characters separated by two other characters.

Find the countries that have two “o” characters separated by two others.

中文版

“Lesotho 賴索托”和”Moldova 摩爾多瓦”都有兩個字母 o,被另外兩個字母相隔着。

找出所有國家,其名字都有兩個字母 o,被另外兩個字母相隔着。

SELECT `name` FROM world WHERE `name` LIKE '%o__o%' 10. 找出所有國家,其名字都是 4 個字母的。 英文版

Cuba and Togo have four characters names.

Find the countries that have exactly four characters.

中文版

Cuba古巴”和”Togo 多哥”都是 4 個字母。

找出所有國家,其名字都是 4 個字母的。

SELECT `name` FROM world WHERE `name` LIKE '____' 11. 顯示所有國家名字,其首都和國家名字是相同的。 英文版

The capital of Luxembourg is Luxembourg. Show all the countries where the capital is the same as the name of the country

Find the country where the name is the capital city.

中文版

“Luxembourg 盧森堡”的首都 capital 都同樣叫“Luxembourg”。

顯示所有國家名字,其首都和國家名字是相同的。

SELECT `name` FROM world WHERE `name` = capital 12. 顯示所有國家名字,其首都是國家名字加上”City”。 英文版

The capital of Mexico is Mexico City. Show all the countries where the capital has the country together with the word “City”.

Find the country where the capital is the country plus “City”.

The concat function

中文版

“Mexico 墨西哥”的首都是”Mexico City”。

顯示所有國家名字,其首都是國家名字加上”City”。

concat函數

SELECT `name` FROM world WHERE capital = concat( `name`, ' City' ) 13. 找出所有首都和其國家名字,而首都要有國家名字中出現。 英文版

Find the capital and the name where the capital includes the name of the country.

中文版

找出所有首都和其國家名字,而首都要有國家名字中出現。

SELECT capital, `name` FROM world WHERE capital LIKE concat( '%', `name`, '%' ) 14. 找出所有首都和其國家名字,而首都是國家名字的延伸。 英文版

Find the capital and the name where the capital is an extension of name of the country.

You should include Mexico City as it is longer than Mexico. You should not include Luxembourg as the capital is the same as the country.

中文版

找出所有首都和其國家名字,而首都是國家名字的延伸。 你應顯示 Mexico City,因它比其國家名字 Mexico 長,你不應顯示 Luxembourg,因它的首都和國家名相是相同的。

SELECT `name`, capital FROM world WHERE capital LIKE concat( `name`, '%' ) AND (capital != `name`) 15. 顯示國家名字,及其延伸詞,如首都是國家名字的延伸。 英文版

For Monaco-Ville the name is Monaco and the extension is -Ville.S

how the name and the extension where the capital is an extension of name of the country.

You can use the SQL function REPLACE.

中文版

“Monaco-Ville"是合併國家名字 “Monaco” 和延伸詞”-Ville".

顯示國家名字,及其延伸詞,如首都是國家名字的延伸。

你可以使用SQL函數 REPLACE 或 MID.

SELECT `name`, REPLACE ( capital, `name`, '' ) AS ext FROM world WHERE capital LIKE concat( `name`, '%' ) AND (capital != `name`)


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3