forked from zufuliu/notepad4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SQLite3.sql
314 lines (311 loc) · 3.87 KB
/
SQLite3.sql
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
-- 3.44 https://sqlite.org/lang.html
--! keywords ===========================================================
-- https://sqlite.org/lang_keywords.html
ABORT
ACTION
ADD
AFTER
ALL
ALTER
ALWAYS
ANALYZE
AND
AS
ASC
ATTACH
AUTOINCREMENT
BEFORE
BEGIN
END
BETWEEN
BY
CASCADE
CASE
END CASE;
CAST
CHECK
COLLATE
COLUMN
COMMIT
CONFLICT
CONSTRAINT
CREATE
CROSS
CURRENT
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
DATABASE
DEFAULT
DEFERRABLE
DEFERRED
DELETE
DESC
DETACH
DISTINCT
DO
DROP
EACH
ELSE
END
ESCAPE
EXCEPT
EXCLUDE
EXCLUSIVE
EXISTS
EXPLAIN
FAIL
FILTER
FIRST
FOLLOWING
FOR
FOREIGN
FROM
FULL
GENERATED
GLOB
GROUP
GROUPS
HAVING
IF
IGNORE
IMMEDIATE
IN
INDEX
INDEXED
INITIALLY
INNER
INSERT
INSTEAD
INTERSECT
INTO
IS
ISNULL
JOIN
KEY
LAST
LEFT
LIKE
LIMIT
MATCH
MATERIALIZED
NATURAL
NO
NOT
NOTHING
NOTNULL
NULL
NULLS
OF
OFFSET
ON
OR
ORDER
OTHERS
OUTER
OVER
PARTITION
PLAN
PRAGMA
PRECEDING
PRIMARY
QUERY
RAISE
RANGE
RECURSIVE
REFERENCES
REGEXP
REINDEX
RELEASE
RENAME
REPLACE
RESTRICT
RETURNING
RIGHT
ROLLBACK
ROW
ROWS
SAVEPOINT
SELECT
SET
TABLE
TEMP
TEMPORARY
THEN
END IF;
TIES
TO
TRANSACTION
TRIGGER
UNBOUNDED
UNION
UNIQUE
UPDATE
USING
VACUUM
VALUES
VIEW
VIRTUAL
WHEN
WHERE
WINDOW
WITH
WITHOUT
-- Collating Sequences
BINARY
NOCASE
RTRIM
--! Data Types ===========================================================
-- https://sqlite.org/datatype3.html
TEXT
NUMERIC
INTEGER
REAL
BLOB
-- Type Affinity
BIGINT
BOOLEAN
CHARACTER
CLOB
DATE
DATETIME
DECIMAL
DOUBLE
DOUBLE PRECISION
FLOAT
INT
INT2
INT8
INTEGER
MEDIUMINT
NATIVE CHARACTER
NCHAR
NUMERIC
NVARCHAR
REAL
SMALLINT
TEXT
TINYINT
UNSIGNED BIGINT
VARCHAR
VARYING CHARACTER
--! Functions ============================================================
-- aggregate functions
-- https://sqlite.org/lang_aggfunc.html
avg(X)
count(*)
count(X)
group_concat(X)
group_concat(X, Y)
string_agg(X, Y)
max(X)
min(X)
sum(X)
total(X)
-- date and time functions
-- https://sqlite.org/lang_datefunc.html
date(timestring, modifier, modifier, ...)
time(timestring, modifier, modifier, ...)
datetime(timestring, modifier, modifier, ...)
julianday(timestring, modifier, modifier, ...)
unixepoch(time-value, modifier, modifier, ...)
strftime(format, timestring, modifier, modifier, ...)
timediff(time-value, time-value)
-- Built-in Window Functions
-- https://sqlite.org/windowfunctions.html#biwinfunc
row_number()
rank()
dense_rank()
percent_rank()
cume_dist()
ntile(N)
lag(expr)
lag(expr, offset)
lag(expr, offset, default)
lead(expr)
lead(expr, offset)
lead(expr, offset, default)
first_value(expr)
last_value(expr)
nth_value(expr, N)
-- core functions
-- https://sqlite.org/lang_corefunc.html
abs(X)
changes()
char(X1, X2, ..., XN)
coalesce(X, Y, ...)
concat(X,...)
concat_ws(SEP,X,...)
format(FORMAT,...)
glob(X, Y)
hex(X)
ifnull(X, Y)
iif(X, Y, Z)
instr(X, Y)
last_insert_rowid()
length(X)
like(X, Y)
like(X, Y, Z)
likelihood(X, Y)
likely(X)
load_extension(X)
load_extension(X, Y)
lower(X)
ltrim(X)
ltrim(X, Y)
max(X, Y, ...)
min(X, Y, ...)
nullif(X, Y)
octet_length(X)
printf(FORMAT, ...)
quote(X)
random()
randomblob(N)
replace(X, Y, Z)
round(X)
round(X, Y)
rtrim(X)
rtrim(X, Y)
soundex(X)
sqlite_compileoption_get(N)
sqlite_compileoption_used(X)
sqlite_offset(X)
sqlite_source_id()
sqlite_version()
substr(X, Y)
substr(X, Y, Z)
substring(X, Y)
substring(X, Y, Z)
total_changes()
trim(X)
trim(X, Y)
typeof(X)
unhex(X)
unhex(X, Y)
unicode(X)
unlikely(X)
upper(X)
zeroblob(N)
-- JSON1
-- https://www.sqlite.org/json1.html
json(json)
json_array(value1, value2, ...)
json_array_length(json)
json_array_length(json, path)
json_extract(json, path, ...)
json_insert(json, path, value,...)
json_object(label1, value1, ...)
json_patch(json1, json2)
json_remove(json, path, ...)
json_replace(json, path, value, ...)
json_set(json, path, value, ...)
json_type(json)
json_type(json, path)
json_valid(json)
json_quote(value)
json_group_array(value)
json_group_object(name, value)
json_each(json)
json_each(json, path)
json_tree(json)
json_tree(json, path)