-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect_quiz.sql
More file actions
63 lines (55 loc) · 969 Bytes
/
select_quiz.sql
File metadata and controls
63 lines (55 loc) · 969 Bytes
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
-- SELECT QUIZ ANSWERS:
SELECT
name, population
FROM
world
WHERE
population BETWEEN 1000000 AND 1250000;
-- 2) Pick the result you would obtain from this code:
SELECT
name, population
FROM
world
WHERE
name LIKE 'Al%';
-- ANS: Table-E
-- Albania 3200000
-- Algeria 32900000
SELECT
name
FROM
world
WHERE
name LIKE '%a' OR name LIKE '%l';
-- 4) result from the query
SELECT
name, LENGTH(name)
FROM
world
WHERE
LENGTH(name) = 5 AND region = 'Europe';
-- ANS:
-- name length(name)
-- Italy 5
-- Malta 5
-- Spain 5
SELECT
name, area * 2
FROM
world
WHERE
population = 64000;
-- ANS: Andorra 936
SELECT
name, area, population
FROM
world
WHERE
area > 50000 AND population < 10000000;
-- 7) code that shows the population density of China, Australia, Nigeria and France
SELECT
name, population / area
FROM
world
WHERE
name IN ('China' , 'Nigeria', 'France', 'Australia');