-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSelect-Select.sql
More file actions
64 lines (43 loc) · 1.71 KB
/
Select-Select.sql
File metadata and controls
64 lines (43 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
-- #1
SELECT name FROM world WHERE population > (SELECT population FROM world WHERE name = 'Russia');
-- #2
SELECT name FROM world WHERE gdp / population >
(SELECT gdp / population FROM world WHERE name = 'United Kingdom') AND continent = 'Europe';
-- #3
SELECT name, continent FROM world WHERE continent IN (SELECT continent FROM world WHERE name = 'Argentina' UNION SELECT continent FROM world WHERE name = 'Australia');
-- #4
SELECT name, population FROM WORLD WHERE population > (SELECT population FROM world WHERE name = 'United Kingdom') AND population < (SELECT population FROM world WHERE name = 'Germany');
-- #5
-- MySql
SELECT
name,
CONCAT(ROUND((population*100)/(SELECT population
FROM world WHERE name='Germany'), 0), '%') as percentage
FROM world WHERE continent = 'Europe';
-- #6
SELECT name FROM WORLD WHERE gdp > ALL(SELECT gdp FROM world WHERE continent = 'Europe');
-- #7
SELECT continent, name, area FROM world x
WHERE area >= ALL
(SELECT area FROM world y
WHERE y.continent=x.continent);
-- #8
SELECT continent,name FROM world x
WHERE x.name <= ALL(SELECT y.name FROM world y
WHERE x.continent = y.continent)
ORDER BY continent;
-- #9
SELECT name, continent, population
FROM world x
WHERE population = ALL(SELECT population
FROM world y
WHERE y.continent = x.continent
AND population <= 25000000);
-- #10
-- MySQL
SELECT x.name, x.continent
FROM world x
WHERE x.population > ALL(SELECT population*3
FROM world y
WHERE y.continent = x.continent
AND x.name != y.name)