blob: 229ffd8f971543b1cd3422435826201bd57331dc (
plain)
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
|
drop table ͪߩѦ���;
ERROR: table "ͪߩѦ���" does not exist
create table ͪߩѦ��� (��� text, ���ڵ� varchar, ���1A�� char(16));
create index ͪߩѦ���index1 on ͪߩѦ��� using btree (���);
create index ͪߩѦ���index2 on ͪߩѦ��� using hash (���ڵ�);
insert into ͪߩѦ��� values('��ǻ�͵��÷���', 'ѦA01߾');
insert into ͪߩѦ��� values('��ǻ�ͱ��Ƚ�', '��B10��');
insert into ͪߩѦ��� values('��ǻ�����α���', '��Z01��');
vacuum ͪߩѦ���;
select * from ͪߩѦ���;
��� | ���ڵ� | ���1a��
------------------+----------+------------
��ǻ�͵��÷��� | ѦA01߾ |
��ǻ�ͱ��Ƚ� | ��B10�� |
��ǻ�����α��� | ��Z01�� |
(3 rows)
select * from ͪߩѦ��� where ���ڵ� = '��Z01��';
��� | ���ڵ� | ���1a��
------------------+----------+------------
��ǻ�����α��� | ��Z01�� |
(1 row)
select * from ͪߩѦ��� where ���ڵ� ~* '��z01��';
��� | ���ڵ� | ���1a��
------------------+----------+------------
��ǻ�����α��� | ��Z01�� |
(1 row)
select * from ͪߩѦ��� where ���ڵ� like '_Z01_';
��� | ���ڵ� | ���1a��
------------------+----------+------------
��ǻ�����α��� | ��Z01�� |
(1 row)
select * from ͪߩѦ��� where ���ڵ� like '_Z%';
��� | ���ڵ� | ���1a��
------------------+----------+------------
��ǻ�����α��� | ��Z01�� |
(1 row)
select * from ͪߩѦ��� where ��� ~ '��ǻ��[���]';
��� | ���ڵ� | ���1a��
------------------+----------+------------
��ǻ�͵��÷��� | ѦA01߾ |
��ǻ�ͱ��Ƚ� | ��B10�� |
(2 rows)
select * from ͪߩѦ��� where ��� ~* '��ǻ��[���]';
��� | ���ڵ� | ���1a��
------------------+----------+------------
��ǻ�͵��÷��� | ѦA01߾ |
��ǻ�ͱ��Ƚ� | ��B10�� |
(2 rows)
select *,character_length(���) from ͪߩѦ���;
��� | ���ڵ� | ���1a�� | character_length
------------------+----------+------------+------------------
��ǻ�͵��÷��� | ѦA01߾ | | 8
��ǻ�ͱ��Ƚ� | ��B10�� | | 7
��ǻ�����α��� | ��Z01�� | | 8
(3 rows)
select *,octet_length(���) from ͪߩѦ���;
��� | ���ڵ� | ���1a�� | octet_length
------------------+----------+------------+--------------
��ǻ�͵��÷��� | ѦA01߾ | | 16
��ǻ�ͱ��Ƚ� | ��B10�� | | 14
��ǻ�����α��� | ��Z01�� | | 16
(3 rows)
select *,position('��' in ���) from ͪߩѦ���;
��� | ���ڵ� | ���1a�� | position
------------------+----------+------------+----------
��ǻ�͵��÷��� | ѦA01߾ | | 4
��ǻ�ͱ��Ƚ� | ��B10�� | | 0
��ǻ�����α��� | ��Z01�� | | 0
(3 rows)
select *,substring(��� from 3 for 4) from ͪߩѦ���;
��� | ���ڵ� | ���1a�� | substring
------------------+----------+------------+-----------
��ǻ�͵��÷��� | ѦA01߾ | | �͵���
��ǻ�ͱ��Ƚ� | ��B10�� | | �ͱ���
��ǻ�����α��� | ��Z01�� | | �����α�
(3 rows)
|