-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstrings.sql.txt
30 lines (23 loc) · 871 Bytes
/
strings.sql.txt
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
-- STRING LENGTH
=========================================
select name, length(name) as name_length from city;
select name, length(name) as name_length from city order by name_length desc, name;
-- SUBSTR (substring)
=========================================
select released,
substr(released, 1, 4) as Year,
substr(released, 6, 2) as Month,
substr(released, 9, 2) as Day
from album order by released;
select substr(name, 1, 3) || substr(continent, 1, 5) as IdName from country; (CONCATENATION)
-- TRIMS
=========================================
select trim(' helo .. ');
select ltrim(' helo .. ');
select rtrim(' helo .. ');
select trim(' helo..', '.');
-- UPPER/LOWER
=========================================
select upper(name) from country;
select lower(name) from country;
select upper(name) = lower(name) from country; (Answer = 0)