융무의 기술블로그
article thumbnail
Published 2020. 7. 2. 20:24
[SQL][sqlzoo] SELECT basics Algorithm/SQL

https://sqlzoo.net/wiki/SELECT_basics

 

SELECT basics - SQLZOO

Checking a list The word IN allows us to check if an item is in a list. The example shows the name and population for the countries 'Brazil', 'Russia', 'India' and 'China'. Show the name and the population for 'Sweden', 'Norway' and 'Denmark'. SELECT name,

sqlzoo.net

1.Introducing the world table of countries

SELECT population
FROM world
WHERE name = 'Germany'

2.Scandinavia

SELECT name, population 
FROM world
WHERE name IN ('Denmark', 'Norway', 'Sweden');

3.Just the right size

SELECT name, area 
FROM world
WHERE area BETWEEN 200000 AND 250000;

 

SELECT Quiz                                                                                                                       

1.

SELECT name, population
  FROM world
 WHERE population BETWEEN 1000000 AND 1250000

2.

Table-E

Albania 3200000
Algeria 32900000

3.

SELECT name FROM world
 WHERE name LIKE '%a' OR name LIKE '%l'

4.

name  length(name)
Italy 5
Malta 5
Spain 5

5.

Andorra 936

6.

SELECT name, area, population
  FROM world
 WHERE area > 50000 AND population < 10000000

7.

SELECT name, population/area
  FROM world
 WHERE name IN ('China', 'Nigeria', 'France', 'Australia')

 

profile

융무의 기술블로그

@융무

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!