-
Notifications
You must be signed in to change notification settings - Fork 0
/
28.MySQL String Functions.txt
95 lines (68 loc) · 2.32 KB
/
28.MySQL String Functions.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
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
SELECT id, UPPER(name), marks
FROM summary
SELECT id, UCASE(name), marks
FROM summary
SELECT id, LOWER(name), marks
FROM summary
SELECT id, LCASE(name), marks
FROM summary
SELECT id, name, CHARACTER_LENGTH(name) AS Characters
FROM summary
SELECT id, name, CHAR_LENGTH(name) AS Characters
FROM summary
SELECT id, name, LENGTH(name) AS Characters
FROM summary
SELECT CONCAT("HELLO", "WORLD");
SELECT CONCAT("HELLO", "-" , "WORLD") AS Name;
SELECT CONCAT_WS("-" ,"HELLO", "WORLD");
SELECT id, name, CONCAT(name, marks) AS Name
FROM summary
SELECT id, name, CONCAT(name, "-", marks) AS Name
FROM summary
SELECT id, name, CONCAT_WS(name, marks) AS Name
FROM summary
SELECT id, name, CONCAT_WS("-", name, marks) AS Name
FROM summary
SELECT LTRIM(" Hello ")
SELECT RTRIM(" Hello ")
SELECT TRIM(" Hello ")
SELECT POSITION("World" IN "Hello World")
SELECT POSITION("e" IN "Hello World")
SELECT INSTR("Hello World", "a")
SELECT INSTR("Hello World", "World")
SELECT LOCATE("llo", "Hello World")
SELECT LOCATE("e", "Hello World")
SELECT LOCATE("lo", "Hello World", 3)
SELECT SUBSTRING("Hello World", 5) AS Name
SELECT SUBSTRING("Hello World", 3, 6)
SELECT SUBSTR("Hello World", -3, 6)
SELECT MID("Hello World", 3, 6)
SELECT SUBSTRING_INDEX("www.HelloWorld.com", ".", 5) AS Name
SELECT SUBSTRING_INDEX("www.HelloWorld.com", "o", 5)
SELECT LEFT("Hello World", 6)
SELECT LEFT("Hello World", 3)
SELECT RIGHT("Hello World", 6)
SELECT RIGHT("Hello World", 3)
SELECT RPAD("Hello World", 20, "-")
SELECT RPAD("Hello World", 23, "abcdef")
SELECT LPAD("Hello World", 20, "*")
SELECT LPAD("Hello World", 23, "15347684")
SELECT SPACE(100)
SELECT SPACE(100)
SELECT REVERSE("Hello World")
SELECT REPLACE("Hello World", "World", "earth")
SELECT REPLACE("Hello World World", "World", "earth")
SELECT REPLACE("Hello World", "World", "earth")
SELECT REPLACE("Hello World World", "World", "earth")
SELECT STRCMP("Hello World", "Hello World")
SELECT STRCMP("Hello World", "Hello")
SELECT STRCMP("Hello World World", "Hello World")
SELECT FIELD("H", "e", "l", "h", "e")
SELECT FIELD("Hmm", "hmm", "lar", "har", "earn")
SELECT FIELD(5, 0, 1, 2, 3)
SELECT FIND_IN_set("H", "e,l,h,e")
SELECT FIND_IN_set("Hmm", "hmm,lar,har,earn")
SELECT FORMAT(255.3568, 2) AS Value
SELECT FORMAT(255.35689, 3) AS Value
SELECT HEX("Hello World")
SELECT HEX("Emran Hasan")