@enjoys/context-engine 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,472 +2,1144 @@
2
2
  "language": "sql",
3
3
  "definitions": {
4
4
  "SELECT": {
5
- "signature": "SELECT [DISTINCT] column1, column2, ... FROM table [WHERE ...] [GROUP BY ...] [HAVING ...] [ORDER BY ...] [LIMIT n]",
6
- "description": "Retrieves rows and columns from one or more tables. The most commonly used SQL statement for querying data. Supports filtering, grouping, sorting, and limiting results.",
7
- "type": "keyword",
5
+ "signature": "SELECT [ALL | DISTINCT] columns FROM table [WHERE ...] [GROUP BY ...] [HAVING ...] [ORDER BY ...] [LIMIT ...]",
6
+ "description": "Retrieve data from one or more tables.",
7
+ "type": "statement",
8
8
  "module": "DML"
9
9
  },
10
10
  "INSERT": {
11
- "signature": "INSERT INTO table (column1, column2, ...) VALUES (value1, value2, ...)",
12
- "description": "Inserts one or more new rows into a table. Can insert explicit values, results from a SELECT query, or use DEFAULT values.",
13
- "type": "keyword",
11
+ "signature": "INSERT INTO table (columns) VALUES (values) | SELECT ...",
12
+ "description": "Add new rows to a table.",
13
+ "type": "statement",
14
14
  "module": "DML"
15
15
  },
16
16
  "UPDATE": {
17
- "signature": "UPDATE table SET column1 = value1, column2 = value2, ... [WHERE condition]",
18
- "description": "Modifies existing rows in a table. Without a WHERE clause, all rows in the table are updated. Supports joins in some databases.",
19
- "type": "keyword",
17
+ "signature": "UPDATE table SET column = value [FROM ...] [WHERE ...] [RETURNING ...]",
18
+ "description": "Modify existing rows in a table.",
19
+ "type": "statement",
20
20
  "module": "DML"
21
21
  },
22
22
  "DELETE": {
23
- "signature": "DELETE FROM table [WHERE condition]",
24
- "description": "Removes rows from a table that match the WHERE condition. Without WHERE, all rows are deleted. Unlike TRUNCATE, DELETE is logged and can be rolled back.",
25
- "type": "keyword",
23
+ "signature": "DELETE FROM table [USING ...] [WHERE ...] [RETURNING ...]",
24
+ "description": "Remove rows from a table.",
25
+ "type": "statement",
26
+ "module": "DML"
27
+ },
28
+ "MERGE": {
29
+ "signature": "MERGE INTO target USING source ON condition WHEN MATCHED THEN ... WHEN NOT MATCHED THEN ...",
30
+ "description": "Conditionally insert, update, or delete rows (SQL:2003 standard).",
31
+ "type": "statement",
32
+ "module": "DML"
33
+ },
34
+ "TRUNCATE": {
35
+ "signature": "TRUNCATE [TABLE] table [CASCADE | RESTRICT]",
36
+ "description": "Remove all rows from a table quickly without logging individual deletions.",
37
+ "type": "statement",
26
38
  "module": "DML"
27
39
  },
28
40
  "CREATE TABLE": {
29
- "signature": "CREATE TABLE [IF NOT EXISTS] table_name (column_name data_type [constraints], ...)",
30
- "description": "Creates a new table with the specified columns, data types, and optional constraints such as PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK, and DEFAULT.",
31
- "type": "keyword",
41
+ "signature": "CREATE [TEMPORARY] TABLE [IF NOT EXISTS] name (column_defs, constraints) [PARTITION BY ...]",
42
+ "description": "Create a new table.",
43
+ "type": "statement",
32
44
  "module": "DDL"
33
45
  },
34
46
  "ALTER TABLE": {
35
- "signature": "ALTER TABLE table_name ADD|DROP|MODIFY|RENAME COLUMN ...",
36
- "description": "Modifies the structure of an existing table. Can add, remove, or modify columns and constraints, or rename the table.",
37
- "type": "keyword",
47
+ "signature": "ALTER TABLE name ADD|DROP|ALTER|RENAME ...",
48
+ "description": "Modify the structure of an existing table.",
49
+ "type": "statement",
38
50
  "module": "DDL"
39
51
  },
40
52
  "DROP TABLE": {
41
- "signature": "DROP TABLE [IF EXISTS] table_name [CASCADE]",
42
- "description": "Permanently removes a table and all its data from the database. Use IF EXISTS to avoid errors when the table doesn't exist. CASCADE drops dependent objects.",
43
- "type": "keyword",
53
+ "signature": "DROP TABLE [IF EXISTS] name [CASCADE | RESTRICT]",
54
+ "description": "Remove a table and its data.",
55
+ "type": "statement",
44
56
  "module": "DDL"
45
57
  },
46
58
  "CREATE INDEX": {
47
- "signature": "CREATE [UNIQUE] INDEX index_name ON table (column1 [ASC|DESC], ...)",
48
- "description": "Creates an index on one or more table columns to speed up data retrieval. UNIQUE indexes also enforce uniqueness constraints.",
49
- "type": "keyword",
59
+ "signature": "CREATE [UNIQUE] INDEX [CONCURRENTLY] name ON table [USING method] (columns) [INCLUDE (...)] [WHERE ...]",
60
+ "description": "Create an index to speed up queries.",
61
+ "type": "statement",
62
+ "module": "DDL"
63
+ },
64
+ "DROP INDEX": {
65
+ "signature": "DROP INDEX [CONCURRENTLY] [IF EXISTS] name",
66
+ "description": "Remove an index.",
67
+ "type": "statement",
50
68
  "module": "DDL"
51
69
  },
52
70
  "CREATE VIEW": {
53
- "signature": "CREATE [OR REPLACE] VIEW view_name AS SELECT ...",
54
- "description": "Creates a virtual table based on a SELECT statement. Views simplify complex queries, provide abstraction, and can be used for security by limiting column access.",
55
- "type": "keyword",
71
+ "signature": "CREATE [OR REPLACE] VIEW name AS SELECT ... [WITH CHECK OPTION]",
72
+ "description": "Create a named view based on a query.",
73
+ "type": "statement",
56
74
  "module": "DDL"
57
75
  },
58
- "TRUNCATE": {
59
- "signature": "TRUNCATE TABLE table_name",
60
- "description": "Removes all rows from a table efficiently. Faster than DELETE as it doesn't log individual row deletions. Resets auto-increment counters in most databases.",
61
- "type": "keyword",
76
+ "DROP VIEW": {
77
+ "signature": "DROP VIEW [IF EXISTS] name [CASCADE]",
78
+ "description": "Remove a view.",
79
+ "type": "statement",
62
80
  "module": "DDL"
63
81
  },
64
- "WHERE": {
65
- "signature": "WHERE condition [AND|OR condition ...]",
66
- "description": "Filters rows based on specified conditions. Used with SELECT, UPDATE, and DELETE. Supports comparison operators, logical operators, BETWEEN, IN, LIKE, IS NULL, and subqueries.",
67
- "type": "keyword",
68
- "module": "DML"
82
+ "CREATE MATERIALIZED VIEW": {
83
+ "signature": "CREATE MATERIALIZED VIEW name AS SELECT ... [WITH [NO] DATA]",
84
+ "description": "Create a view that stores its result set physically.",
85
+ "type": "statement",
86
+ "module": "DDL"
87
+ },
88
+ "CREATE SCHEMA": {
89
+ "signature": "CREATE SCHEMA [IF NOT EXISTS] name [AUTHORIZATION role]",
90
+ "description": "Create a new schema (namespace for database objects).",
91
+ "type": "statement",
92
+ "module": "DDL"
93
+ },
94
+ "DROP SCHEMA": {
95
+ "signature": "DROP SCHEMA [IF EXISTS] name [CASCADE | RESTRICT]",
96
+ "description": "Remove a schema.",
97
+ "type": "statement",
98
+ "module": "DDL"
99
+ },
100
+ "CREATE SEQUENCE": {
101
+ "signature": "CREATE SEQUENCE name [START WITH n] [INCREMENT BY n] [MINVALUE n | NO MINVALUE] ...",
102
+ "description": "Create an auto-incrementing number generator.",
103
+ "type": "statement",
104
+ "module": "DDL"
105
+ },
106
+ "ALTER SEQUENCE": {
107
+ "signature": "ALTER SEQUENCE name RESTART [WITH value] | INCREMENT BY ...",
108
+ "description": "Modify a sequence.",
109
+ "type": "statement",
110
+ "module": "DDL"
111
+ },
112
+ "CREATE FUNCTION": {
113
+ "signature": "CREATE [OR REPLACE] FUNCTION name(params) RETURNS type AS $$ body $$ LANGUAGE lang",
114
+ "description": "Create a user-defined function.",
115
+ "type": "statement",
116
+ "module": "DDL"
117
+ },
118
+ "CREATE PROCEDURE": {
119
+ "signature": "CREATE [OR REPLACE] PROCEDURE name(params) LANGUAGE lang AS $$ body $$",
120
+ "description": "Create a stored procedure.",
121
+ "type": "statement",
122
+ "module": "DDL"
123
+ },
124
+ "CREATE TRIGGER": {
125
+ "signature": "CREATE TRIGGER name {BEFORE|AFTER|INSTEAD OF} event ON table FOR EACH {ROW|STATEMENT} EXECUTE FUNCTION func()",
126
+ "description": "Create a trigger that fires on table events.",
127
+ "type": "statement",
128
+ "module": "DDL"
129
+ },
130
+ "CREATE TYPE": {
131
+ "signature": "CREATE TYPE name AS (fields) | AS ENUM (values)",
132
+ "description": "Create a custom composite or enum type.",
133
+ "type": "statement",
134
+ "module": "DDL"
135
+ },
136
+ "COMMENT ON": {
137
+ "signature": "COMMENT ON {TABLE|COLUMN|INDEX|...} name IS 'text'",
138
+ "description": "Add a descriptive comment to a database object.",
139
+ "type": "statement",
140
+ "module": "DDL"
69
141
  },
70
142
  "INNER JOIN": {
71
- "signature": "table1 INNER JOIN table2 ON table1.column = table2.column",
72
- "description": "Returns only rows where there is a match in both tables. The most common type of join. Equivalent to just writing JOIN.",
73
- "type": "keyword",
74
- "module": "DML"
143
+ "signature": "table1 INNER JOIN table2 ON condition",
144
+ "description": "Return rows that have matching values in both tables.",
145
+ "type": "clause",
146
+ "module": "JOIN"
75
147
  },
76
148
  "LEFT JOIN": {
77
- "signature": "table1 LEFT [OUTER] JOIN table2 ON table1.column = table2.column",
78
- "description": "Returns all rows from the left table and matching rows from the right table. If no match exists, NULL values are returned for right table columns.",
79
- "type": "keyword",
80
- "module": "DML"
149
+ "signature": "table1 LEFT [OUTER] JOIN table2 ON condition",
150
+ "description": "Return all rows from left table plus matching rows from right.",
151
+ "type": "clause",
152
+ "module": "JOIN"
81
153
  },
82
154
  "RIGHT JOIN": {
83
- "signature": "table1 RIGHT [OUTER] JOIN table2 ON table1.column = table2.column",
84
- "description": "Returns all rows from the right table and matching rows from the left table. If no match exists, NULL values are returned for left table columns.",
85
- "type": "keyword",
86
- "module": "DML"
155
+ "signature": "table1 RIGHT [OUTER] JOIN table2 ON condition",
156
+ "description": "Return all rows from right table plus matching rows from left.",
157
+ "type": "clause",
158
+ "module": "JOIN"
87
159
  },
88
160
  "FULL OUTER JOIN": {
89
- "signature": "table1 FULL OUTER JOIN table2 ON table1.column = table2.column",
90
- "description": "Returns all rows from both tables, with NULLs where there is no match. Combines the results of LEFT JOIN and RIGHT JOIN.",
91
- "type": "keyword",
92
- "module": "DML"
161
+ "signature": "table1 FULL OUTER JOIN table2 ON condition",
162
+ "description": "Return all rows when there is a match in either table.",
163
+ "type": "clause",
164
+ "module": "JOIN"
93
165
  },
94
166
  "CROSS JOIN": {
95
167
  "signature": "table1 CROSS JOIN table2",
96
- "description": "Produces a Cartesian product every row from the first table is combined with every row from the second table. No ON clause is used.",
97
- "type": "keyword",
98
- "module": "DML"
168
+ "description": "Return the Cartesian product of both tables.",
169
+ "type": "clause",
170
+ "module": "JOIN"
171
+ },
172
+ "NATURAL JOIN": {
173
+ "signature": "table1 NATURAL JOIN table2",
174
+ "description": "Join on all columns with matching names in both tables.",
175
+ "type": "clause",
176
+ "module": "JOIN"
177
+ },
178
+ "LATERAL JOIN": {
179
+ "signature": "FROM table1, LATERAL (subquery) alias",
180
+ "description": "A subquery that can reference columns from preceding FROM items (PostgreSQL).",
181
+ "type": "clause",
182
+ "module": "JOIN"
99
183
  },
100
- "GROUP BY": {
101
- "signature": "GROUP BY column1, column2, ...",
102
- "description": "Groups rows that share values in specified columns into summary rows. Typically used with aggregate functions (COUNT, SUM, AVG, MIN, MAX).",
103
- "type": "keyword",
104
- "module": "DML"
105
- },
106
- "HAVING": {
107
- "signature": "HAVING aggregate_condition",
108
- "description": "Filters groups created by GROUP BY based on aggregate conditions. Similar to WHERE but operates on grouped results rather than individual rows.",
109
- "type": "keyword",
110
- "module": "DML"
184
+ "COUNT": {
185
+ "signature": "COUNT(*) | COUNT([DISTINCT] expression)",
186
+ "description": "Count the number of rows or non-null values.",
187
+ "type": "function",
188
+ "module": "Aggregate"
111
189
  },
112
- "ORDER BY": {
113
- "signature": "ORDER BY column1 [ASC|DESC], column2 [ASC|DESC], ...",
114
- "description": "Sorts the result set by one or more columns. ASC (ascending) is the default. DESC sorts in descending order. NULLS FIRST/LAST controls NULL positioning.",
115
- "type": "keyword",
116
- "module": "DML"
190
+ "SUM": {
191
+ "signature": "SUM([DISTINCT] expression)",
192
+ "description": "Calculate the sum of values.",
193
+ "type": "function",
194
+ "module": "Aggregate"
117
195
  },
118
- "UNION": {
119
- "signature": "SELECT ... UNION [ALL] SELECT ...",
120
- "description": "Combines result sets from multiple SELECT statements. UNION removes duplicates; UNION ALL keeps them. All SELECTs must have the same number of columns with compatible types.",
121
- "type": "keyword",
122
- "module": "DML"
196
+ "AVG": {
197
+ "signature": "AVG([DISTINCT] expression)",
198
+ "description": "Calculate the arithmetic mean.",
199
+ "type": "function",
200
+ "module": "Aggregate"
123
201
  },
124
- "WITH": {
125
- "signature": "WITH cte_name AS (SELECT ...) SELECT ... FROM cte_name",
126
- "description": "Defines a Common Table Expression (CTE) — a temporary named result set. Improves readability for complex queries. Supports recursion with WITH RECURSIVE.",
127
- "type": "keyword",
128
- "module": "DML"
202
+ "MIN": {
203
+ "signature": "MIN(expression)",
204
+ "description": "Find the minimum value.",
205
+ "type": "function",
206
+ "module": "Aggregate"
129
207
  },
130
- "CASE": {
131
- "signature": "CASE WHEN condition THEN result [WHEN ...] [ELSE default] END",
132
- "description": "Conditional expression that returns a value based on the first matching WHEN condition. Similar to IF-THEN-ELSE logic in procedural languages.",
133
- "type": "keyword",
134
- "module": "DML"
208
+ "MAX": {
209
+ "signature": "MAX(expression)",
210
+ "description": "Find the maximum value.",
211
+ "type": "function",
212
+ "module": "Aggregate"
135
213
  },
136
- "EXISTS": {
137
- "signature": "EXISTS (subquery)",
138
- "description": "Returns TRUE if the subquery returns one or more rows. Commonly used in WHERE clauses for correlated subqueries. More efficient than IN for large datasets.",
139
- "type": "keyword",
140
- "module": "DML"
214
+ "STRING_AGG": {
215
+ "signature": "STRING_AGG(expression, delimiter [ORDER BY ...])",
216
+ "description": "Concatenate strings with a delimiter (PostgreSQL).",
217
+ "type": "function",
218
+ "module": "Aggregate"
141
219
  },
142
- "IN": {
143
- "signature": "expression IN (value1, value2, ...) | expression IN (subquery)",
144
- "description": "Tests whether a value matches any value in a list or subquery result set. Equivalent to multiple OR conditions.",
145
- "type": "keyword",
146
- "module": "DML"
220
+ "GROUP_CONCAT": {
221
+ "signature": "GROUP_CONCAT(expression [ORDER BY ...] [SEPARATOR str])",
222
+ "description": "Concatenate strings within a group (MySQL).",
223
+ "type": "function",
224
+ "module": "Aggregate"
147
225
  },
148
- "BETWEEN": {
149
- "signature": "expression BETWEEN low AND high",
150
- "description": "Filters values within an inclusive range. Equivalent to (expression >= low AND expression <= high). Works with numbers, dates, and strings.",
151
- "type": "keyword",
152
- "module": "DML"
226
+ "ARRAY_AGG": {
227
+ "signature": "ARRAY_AGG(expression [ORDER BY ...])",
228
+ "description": "Collect values into an array (PostgreSQL).",
229
+ "type": "function",
230
+ "module": "Aggregate"
153
231
  },
154
- "LIKE": {
155
- "signature": "expression LIKE pattern [ESCAPE escape_char]",
156
- "description": "Pattern matching operator. '%' matches any sequence of characters, '_' matches a single character. Use ESCAPE for literal '%' or '_'.",
157
- "type": "keyword",
158
- "module": "DML"
232
+ "JSON_AGG": {
233
+ "signature": "JSON_AGG(expression)",
234
+ "description": "Aggregate values as a JSON array (PostgreSQL).",
235
+ "type": "function",
236
+ "module": "Aggregate"
159
237
  },
160
- "LIMIT": {
161
- "signature": "LIMIT count [OFFSET start]",
162
- "description": "Restricts the number of rows returned. OFFSET specifies how many rows to skip. Used for pagination. Not part of the SQL standard (use FETCH FIRST in standard SQL).",
163
- "type": "keyword",
164
- "module": "DML"
238
+ "BOOL_AND": {
239
+ "signature": "BOOL_AND(expression)",
240
+ "description": "TRUE if all input values are true (PostgreSQL).",
241
+ "type": "function",
242
+ "module": "Aggregate"
165
243
  },
166
- "DISTINCT": {
167
- "signature": "SELECT DISTINCT column1, column2, ...",
168
- "description": "Eliminates duplicate rows from the result set based on the selected columns. Can also be used inside aggregate functions like COUNT(DISTINCT column).",
169
- "type": "keyword",
170
- "module": "DML"
244
+ "BOOL_OR": {
245
+ "signature": "BOOL_OR(expression)",
246
+ "description": "TRUE if at least one input value is true (PostgreSQL).",
247
+ "type": "function",
248
+ "module": "Aggregate"
171
249
  },
172
- "AS": {
173
- "signature": "expression AS alias_name",
174
- "description": "Creates an alias for a column, expression, or table. The alias exists only for the duration of the query. Improves readability.",
175
- "type": "keyword",
176
- "module": "DML"
250
+ "ROW_NUMBER": {
251
+ "signature": "ROW_NUMBER() OVER ([PARTITION BY ...] ORDER BY ...)",
252
+ "description": "Assign a unique sequential integer to each row within a partition.",
253
+ "type": "function",
254
+ "module": "Window"
177
255
  },
178
- "INT": {
179
- "signature": "INT | INTEGER",
180
- "description": "A standard integer data type. Stores whole numbers. Typically 4 bytes with a range of -2,147,483,648 to 2,147,483,647. Variants include TINYINT, SMALLINT, MEDIUMINT, and BIGINT.",
181
- "type": "datatype",
182
- "module": "Data Types"
256
+ "RANK": {
257
+ "signature": "RANK() OVER ([PARTITION BY ...] ORDER BY ...)",
258
+ "description": "Rank rows with gaps for ties.",
259
+ "type": "function",
260
+ "module": "Window"
183
261
  },
184
- "BIGINT": {
185
- "signature": "BIGINT",
186
- "description": "A large integer data type. Stores whole numbers up to 8 bytes. Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.",
187
- "type": "datatype",
188
- "module": "Data Types"
262
+ "DENSE_RANK": {
263
+ "signature": "DENSE_RANK() OVER ([PARTITION BY ...] ORDER BY ...)",
264
+ "description": "Rank rows without gaps for ties.",
265
+ "type": "function",
266
+ "module": "Window"
189
267
  },
190
- "VARCHAR": {
191
- "signature": "VARCHAR(n)",
192
- "description": "Variable-length character string with a maximum length of n characters. Only uses storage for the actual string length plus a small overhead. Most common string type.",
193
- "type": "datatype",
194
- "module": "Data Types"
268
+ "NTILE": {
269
+ "signature": "NTILE(n) OVER ([PARTITION BY ...] ORDER BY ...)",
270
+ "description": "Distribute rows into N roughly equal groups.",
271
+ "type": "function",
272
+ "module": "Window"
195
273
  },
196
- "TEXT": {
197
- "signature": "TEXT",
198
- "description": "Variable-length character string for storing large text data. Maximum length varies by database (e.g., up to 65,535 bytes in MySQL). Not suitable for indexing in full.",
199
- "type": "datatype",
200
- "module": "Data Types"
274
+ "LAG": {
275
+ "signature": "LAG(column [, offset [, default]]) OVER ([PARTITION BY ...] ORDER BY ...)",
276
+ "description": "Access value from a preceding row.",
277
+ "type": "function",
278
+ "module": "Window"
201
279
  },
202
- "CHAR": {
203
- "signature": "CHAR(n)",
204
- "description": "Fixed-length character string. Always uses n bytes of storage, padding with spaces if needed. Suitable for fixed-length data like country codes or status flags.",
205
- "type": "datatype",
206
- "module": "Data Types"
280
+ "LEAD": {
281
+ "signature": "LEAD(column [, offset [, default]]) OVER ([PARTITION BY ...] ORDER BY ...)",
282
+ "description": "Access value from a following row.",
283
+ "type": "function",
284
+ "module": "Window"
207
285
  },
208
- "BOOLEAN": {
209
- "signature": "BOOLEAN | BOOL",
210
- "description": "Stores TRUE or FALSE values. Implementation varies: MySQL uses TINYINT(1), PostgreSQL has a native BOOLEAN type. Accepts TRUE/FALSE, 1/0, or YES/NO.",
211
- "type": "datatype",
212
- "module": "Data Types"
286
+ "FIRST_VALUE": {
287
+ "signature": "FIRST_VALUE(column) OVER (window_spec)",
288
+ "description": "Get the first value in the window frame.",
289
+ "type": "function",
290
+ "module": "Window"
213
291
  },
214
- "DATE": {
215
- "signature": "DATE",
216
- "description": "Stores a calendar date (year, month, day) without time. Format: 'YYYY-MM-DD'. Range varies by database.",
217
- "type": "datatype",
218
- "module": "Data Types"
292
+ "LAST_VALUE": {
293
+ "signature": "LAST_VALUE(column) OVER (window_spec ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)",
294
+ "description": "Get the last value in the window frame.",
295
+ "type": "function",
296
+ "module": "Window"
219
297
  },
220
- "TIMESTAMP": {
221
- "signature": "TIMESTAMP",
222
- "description": "Stores date and time with timezone awareness (in some databases). Commonly used for recording creation and modification times. Range is limited compared to DATETIME.",
223
- "type": "datatype",
224
- "module": "Data Types"
298
+ "NTH_VALUE": {
299
+ "signature": "NTH_VALUE(column, n) OVER (window_spec)",
300
+ "description": "Get the Nth value in the window frame.",
301
+ "type": "function",
302
+ "module": "Window"
225
303
  },
226
- "DATETIME": {
227
- "signature": "DATETIME",
228
- "description": "Stores date and time without timezone information. Format: 'YYYY-MM-DD HH:MM:SS'. Suitable for recording events that are timezone-independent.",
229
- "type": "datatype",
230
- "module": "Data Types"
304
+ "PERCENT_RANK": {
305
+ "signature": "PERCENT_RANK() OVER (ORDER BY ...)",
306
+ "description": "Relative rank as a fraction between 0 and 1.",
307
+ "type": "function",
308
+ "module": "Window"
231
309
  },
232
- "FLOAT": {
233
- "signature": "FLOAT[(precision)]",
234
- "description": "Approximate numeric data type for floating-point numbers. Subject to rounding errors. Use DECIMAL for exact numeric values like currency.",
235
- "type": "datatype",
236
- "module": "Data Types"
310
+ "CUME_DIST": {
311
+ "signature": "CUME_DIST() OVER (ORDER BY ...)",
312
+ "description": "Cumulative distribution of a value within a group.",
313
+ "type": "function",
314
+ "module": "Window"
237
315
  },
238
- "DECIMAL": {
239
- "signature": "DECIMAL(precision, scale) | NUMERIC(precision, scale)",
240
- "description": "Exact numeric data type with specified precision (total digits) and scale (digits after decimal point). Ideal for financial and monetary values.",
241
- "type": "datatype",
242
- "module": "Data Types"
316
+ "CONCAT": {
317
+ "signature": "CONCAT(str1, str2, ...)",
318
+ "description": "Concatenate two or more strings.",
319
+ "type": "function",
320
+ "module": "String"
243
321
  },
244
- "BLOB": {
245
- "signature": "BLOB",
246
- "description": "Binary Large Object. Stores binary data such as images, files, or serialized objects. Maximum size varies by database. Variants include TINYBLOB, MEDIUMBLOB, LONGBLOB.",
247
- "type": "datatype",
248
- "module": "Data Types"
322
+ "SUBSTRING": {
323
+ "signature": "SUBSTRING(string FROM start [FOR length])",
324
+ "description": "Extract a substring.",
325
+ "type": "function",
326
+ "module": "String"
249
327
  },
250
- "JSON": {
251
- "signature": "JSON",
252
- "description": "Stores JSON (JavaScript Object Notation) data. Supports validation and querying JSON contents. Available in MySQL 5.7+, PostgreSQL 9.2+ (also JSONB for binary storage).",
253
- "type": "datatype",
254
- "module": "Data Types"
328
+ "LENGTH": {
329
+ "signature": "LENGTH(string)",
330
+ "description": "Return the number of characters (or bytes) in a string.",
331
+ "type": "function",
332
+ "module": "String"
255
333
  },
256
- "UUID": {
257
- "signature": "UUID",
258
- "description": "Stores a Universally Unique Identifier (128-bit value). Common in distributed systems. Native support in PostgreSQL; use CHAR(36) or BINARY(16) in MySQL.",
259
- "type": "datatype",
260
- "module": "Data Types"
334
+ "CHAR_LENGTH": {
335
+ "signature": "CHAR_LENGTH(string)",
336
+ "description": "Return the number of characters in a string.",
337
+ "type": "function",
338
+ "module": "String"
261
339
  },
262
- "ENUM": {
263
- "signature": "ENUM('value1', 'value2', ...)",
264
- "description": "A string object with a value chosen from a list of permitted values. MySQL-specific. PostgreSQL supports creating custom enum types via CREATE TYPE.",
265
- "type": "datatype",
266
- "module": "Data Types"
340
+ "UPPER": {
341
+ "signature": "UPPER(string)",
342
+ "description": "Convert string to uppercase.",
343
+ "type": "function",
344
+ "module": "String"
267
345
  },
268
- "COUNT": {
269
- "signature": "COUNT(*) | COUNT([DISTINCT] expression)",
270
- "description": "Aggregate function that returns the number of rows. COUNT(*) counts all rows including NULLs. COUNT(column) counts non-NULL values. COUNT(DISTINCT column) counts unique values.",
346
+ "LOWER": {
347
+ "signature": "LOWER(string)",
348
+ "description": "Convert string to lowercase.",
271
349
  "type": "function",
272
- "module": "Aggregate Functions"
350
+ "module": "String"
273
351
  },
274
- "SUM": {
275
- "signature": "SUM([DISTINCT] expression)",
276
- "description": "Aggregate function that returns the total sum of a numeric column, ignoring NULL values. Returns NULL if no rows match.",
352
+ "TRIM": {
353
+ "signature": "TRIM([LEADING|TRAILING|BOTH] [chars] FROM string)",
354
+ "description": "Remove leading/trailing characters.",
277
355
  "type": "function",
278
- "module": "Aggregate Functions"
356
+ "module": "String"
279
357
  },
280
- "AVG": {
281
- "signature": "AVG([DISTINCT] expression)",
282
- "description": "Aggregate function that returns the average value of a numeric column, ignoring NULL values.",
358
+ "REPLACE": {
359
+ "signature": "REPLACE(string, from, to)",
360
+ "description": "Replace all occurrences of a substring.",
283
361
  "type": "function",
284
- "module": "Aggregate Functions"
362
+ "module": "String"
285
363
  },
286
- "MIN": {
287
- "signature": "MIN(expression)",
288
- "description": "Aggregate function that returns the smallest value in a column. Works with numeric, string, and date types.",
364
+ "POSITION": {
365
+ "signature": "POSITION(substring IN string)",
366
+ "description": "Return position of substring (1-based).",
289
367
  "type": "function",
290
- "module": "Aggregate Functions"
368
+ "module": "String"
291
369
  },
292
- "MAX": {
293
- "signature": "MAX(expression)",
294
- "description": "Aggregate function that returns the largest value in a column. Works with numeric, string, and date types.",
370
+ "LEFT": {
371
+ "signature": "LEFT(string, n)",
372
+ "description": "Return the leftmost n characters.",
295
373
  "type": "function",
296
- "module": "Aggregate Functions"
374
+ "module": "String"
297
375
  },
298
- "GROUP_CONCAT": {
299
- "signature": "GROUP_CONCAT([DISTINCT] expression [ORDER BY ...] [SEPARATOR str])",
300
- "description": "Concatenates values from multiple rows into a single string. MySQL-specific. PostgreSQL equivalent: STRING_AGG(expression, separator).",
376
+ "RIGHT": {
377
+ "signature": "RIGHT(string, n)",
378
+ "description": "Return the rightmost n characters.",
301
379
  "type": "function",
302
- "module": "Aggregate Functions"
380
+ "module": "String"
303
381
  },
304
- "CONCAT": {
305
- "signature": "CONCAT(string1, string2, ...)",
306
- "description": "Concatenates two or more strings. Returns NULL if any argument is NULL (use CONCAT_WS for NULL-safe concatenation). In PostgreSQL, the || operator is also used.",
382
+ "LPAD": {
383
+ "signature": "LPAD(string, length, fill)",
384
+ "description": "Left-pad a string to a given length.",
307
385
  "type": "function",
308
- "module": "String Functions"
386
+ "module": "String"
309
387
  },
310
- "SUBSTRING": {
311
- "signature": "SUBSTRING(string, start, length) | SUBSTR(string, start, length)",
312
- "description": "Extracts a portion of a string starting at the specified position for the given length. Position is 1-based.",
388
+ "RPAD": {
389
+ "signature": "RPAD(string, length, fill)",
390
+ "description": "Right-pad a string to a given length.",
313
391
  "type": "function",
314
- "module": "String Functions"
392
+ "module": "String"
315
393
  },
316
- "TRIM": {
317
- "signature": "TRIM([LEADING|TRAILING|BOTH] [chars FROM] string)",
318
- "description": "Removes leading and/or trailing characters (default: whitespace) from a string.",
394
+ "REVERSE": {
395
+ "signature": "REVERSE(string)",
396
+ "description": "Reverse a string.",
319
397
  "type": "function",
320
- "module": "String Functions"
398
+ "module": "String"
321
399
  },
322
- "UPPER": {
323
- "signature": "UPPER(string) | UCASE(string)",
324
- "description": "Converts all characters in a string to uppercase.",
400
+ "REPEAT": {
401
+ "signature": "REPEAT(string, n)",
402
+ "description": "Repeat a string n times.",
325
403
  "type": "function",
326
- "module": "String Functions"
404
+ "module": "String"
327
405
  },
328
- "LOWER": {
329
- "signature": "LOWER(string) | LCASE(string)",
330
- "description": "Converts all characters in a string to lowercase.",
406
+ "SPLIT_PART": {
407
+ "signature": "SPLIT_PART(string, delimiter, field)",
408
+ "description": "Split string on delimiter and return field (PostgreSQL).",
331
409
  "type": "function",
332
- "module": "String Functions"
410
+ "module": "String"
333
411
  },
334
- "LENGTH": {
335
- "signature": "LENGTH(string) | LEN(string)",
336
- "description": "Returns the number of characters (or bytes, depending on database) in a string. In MySQL, LENGTH returns bytes; use CHAR_LENGTH for characters.",
412
+ "REGEXP_REPLACE": {
413
+ "signature": "REGEXP_REPLACE(string, pattern, replacement [, flags])",
414
+ "description": "Replace substrings matching a regular expression.",
337
415
  "type": "function",
338
- "module": "String Functions"
416
+ "module": "String"
339
417
  },
340
- "REPLACE": {
341
- "signature": "REPLACE(string, old_substring, new_substring)",
342
- "description": "Replaces all occurrences of a substring within a string with another substring.",
418
+ "TRANSLATE": {
419
+ "signature": "TRANSLATE(string, from_chars, to_chars)",
420
+ "description": "Replace characters one-to-one.",
343
421
  "type": "function",
344
- "module": "String Functions"
422
+ "module": "String"
345
423
  },
346
- "COALESCE": {
347
- "signature": "COALESCE(value1, value2, ...)",
348
- "description": "Returns the first non-NULL value from the argument list. Commonly used to provide default values for potentially NULL columns.",
424
+ "INITCAP": {
425
+ "signature": "INITCAP(string)",
426
+ "description": "Capitalize the first letter of each word (PostgreSQL).",
349
427
  "type": "function",
350
- "module": "Conditional Functions"
428
+ "module": "String"
351
429
  },
352
- "CAST": {
353
- "signature": "CAST(expression AS data_type)",
354
- "description": "Converts a value from one data type to another. Standard SQL type conversion function supported by all major databases.",
430
+ "FORMAT": {
431
+ "signature": "FORMAT(format_string, args ...)",
432
+ "description": "Format a string using printf-style placeholders (PostgreSQL).",
355
433
  "type": "function",
356
- "module": "Conversion Functions"
434
+ "module": "String"
357
435
  },
358
436
  "NOW": {
359
437
  "signature": "NOW()",
360
- "description": "Returns the current date and time as a DATETIME or TIMESTAMP value. In PostgreSQL, equivalent to CURRENT_TIMESTAMP.",
438
+ "description": "Return the current date and time.",
361
439
  "type": "function",
362
- "module": "Date Functions"
440
+ "module": "Date/Time"
363
441
  },
364
442
  "CURRENT_TIMESTAMP": {
365
443
  "signature": "CURRENT_TIMESTAMP",
366
- "description": "Returns the current date and time. A SQL standard keyword that works across all databases. Does not require parentheses.",
444
+ "description": "Return the current date and time (ANSI standard).",
367
445
  "type": "function",
368
- "module": "Date Functions"
446
+ "module": "Date/Time"
369
447
  },
370
- "DATE_ADD": {
371
- "signature": "DATE_ADD(date, INTERVAL value unit)",
372
- "description": "Adds a time interval to a date. Units include DAY, MONTH, YEAR, HOUR, MINUTE, SECOND. MySQL-specific; PostgreSQL uses date + INTERVAL syntax.",
448
+ "CURRENT_DATE": {
449
+ "signature": "CURRENT_DATE",
450
+ "description": "Return the current date.",
373
451
  "type": "function",
374
- "module": "Date Functions"
452
+ "module": "Date/Time"
375
453
  },
376
- "DATEDIFF": {
377
- "signature": "DATEDIFF(date1, date2)",
378
- "description": "Returns the difference in days between two dates (date1 - date2). In SQL Server, supports different date parts.",
454
+ "CURRENT_TIME": {
455
+ "signature": "CURRENT_TIME",
456
+ "description": "Return the current time.",
457
+ "type": "function",
458
+ "module": "Date/Time"
459
+ },
460
+ "DATE_TRUNC": {
461
+ "signature": "DATE_TRUNC(precision, timestamp)",
462
+ "description": "Truncate a timestamp to the specified precision (PostgreSQL).",
379
463
  "type": "function",
380
- "module": "Date Functions"
464
+ "module": "Date/Time"
381
465
  },
382
466
  "EXTRACT": {
383
- "signature": "EXTRACT(part FROM date)",
384
- "description": "Extracts a specified part (YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, etc.) from a date or timestamp value. Standard SQL syntax.",
467
+ "signature": "EXTRACT(field FROM source)",
468
+ "description": "Extract a date/time field (year, month, day, etc.).",
385
469
  "type": "function",
386
- "module": "Date Functions"
470
+ "module": "Date/Time"
387
471
  },
388
- "ROW_NUMBER": {
389
- "signature": "ROW_NUMBER() OVER ([PARTITION BY column] ORDER BY column [ASC|DESC])",
390
- "description": "Window function that assigns a unique sequential integer to each row within its partition. Numbering starts at 1 and increments for each row based on ORDER BY.",
472
+ "DATE_PART": {
473
+ "signature": "DATE_PART(field, source)",
474
+ "description": "Get a subfield from a date or time value (PostgreSQL).",
391
475
  "type": "function",
392
- "module": "Window Functions"
476
+ "module": "Date/Time"
393
477
  },
394
- "RANK": {
395
- "signature": "RANK() OVER ([PARTITION BY column] ORDER BY column [ASC|DESC])",
396
- "description": "Window function that assigns a rank to each row. Rows with equal values get the same rank, and the next rank is skipped (gaps). E.g., 1, 2, 2, 4.",
478
+ "AGE": {
479
+ "signature": "AGE(timestamp1 [, timestamp2])",
480
+ "description": "Calculate the interval between two timestamps (PostgreSQL).",
397
481
  "type": "function",
398
- "module": "Window Functions"
482
+ "module": "Date/Time"
399
483
  },
400
- "DENSE_RANK": {
401
- "signature": "DENSE_RANK() OVER ([PARTITION BY column] ORDER BY column [ASC|DESC])",
402
- "description": "Window function that assigns a rank to each row without gaps. Rows with equal values get the same rank, and the next rank follows immediately. E.g., 1, 2, 2, 3.",
484
+ "TO_CHAR": {
485
+ "signature": "TO_CHAR(value, format)",
486
+ "description": "Format a date, time, or number as text (PostgreSQL).",
403
487
  "type": "function",
404
- "module": "Window Functions"
488
+ "module": "Date/Time"
405
489
  },
406
- "LEAD": {
407
- "signature": "LEAD(expression [, offset [, default]]) OVER ([PARTITION BY column] ORDER BY column)",
408
- "description": "Window function that returns the value of an expression from a subsequent row. Offset defaults to 1. Default value replaces NULL when there is no subsequent row.",
490
+ "TO_DATE": {
491
+ "signature": "TO_DATE(text, format)",
492
+ "description": "Parse a string into a date.",
409
493
  "type": "function",
410
- "module": "Window Functions"
494
+ "module": "Date/Time"
411
495
  },
412
- "LAG": {
413
- "signature": "LAG(expression [, offset [, default]]) OVER ([PARTITION BY column] ORDER BY column)",
414
- "description": "Window function that returns the value of an expression from a preceding row. Offset defaults to 1. Useful for comparing a row with its predecessor.",
496
+ "TO_TIMESTAMP": {
497
+ "signature": "TO_TIMESTAMP(text, format)",
498
+ "description": "Parse a string into a timestamp.",
415
499
  "type": "function",
416
- "module": "Window Functions"
500
+ "module": "Date/Time"
417
501
  },
418
- "NTILE": {
419
- "signature": "NTILE(num_buckets) OVER ([PARTITION BY column] ORDER BY column)",
420
- "description": "Window function that distributes rows into a specified number of approximately equal groups. Each row is assigned a bucket number from 1 to num_buckets.",
502
+ "MAKE_DATE": {
503
+ "signature": "MAKE_DATE(year, month, day)",
504
+ "description": "Construct a date from integer parts (PostgreSQL).",
421
505
  "type": "function",
422
- "module": "Window Functions"
506
+ "module": "Date/Time"
423
507
  },
424
- "PRIMARY KEY": {
425
- "signature": "column_name data_type PRIMARY KEY | CONSTRAINT pk_name PRIMARY KEY (column1, ...)",
426
- "description": "A constraint that uniquely identifies each row in a table. Combines NOT NULL and UNIQUE. Each table can have only one primary key, which can span multiple columns (composite key).",
427
- "type": "constraint",
428
- "module": "Constraints"
508
+ "MAKE_INTERVAL": {
509
+ "signature": "MAKE_INTERVAL(years => n, months => n, days => n, ...)",
510
+ "description": "Construct an interval from parts (PostgreSQL).",
511
+ "type": "function",
512
+ "module": "Date/Time"
429
513
  },
430
- "FOREIGN KEY": {
431
- "signature": "FOREIGN KEY (column) REFERENCES parent_table(parent_column) [ON DELETE action] [ON UPDATE action]",
432
- "description": "A constraint that enforces referential integrity between tables. ON DELETE/UPDATE actions: CASCADE, SET NULL, RESTRICT, NO ACTION, SET DEFAULT.",
433
- "type": "constraint",
434
- "module": "Constraints"
514
+ "DATEDIFF": {
515
+ "signature": "DATEDIFF(datepart, startdate, enddate)",
516
+ "description": "Return the count of datepart boundaries crossed between two dates (MySQL/SQL Server).",
517
+ "type": "function",
518
+ "module": "Date/Time"
519
+ },
520
+ "ABS": {
521
+ "signature": "ABS(n)",
522
+ "description": "Return the absolute value.",
523
+ "type": "function",
524
+ "module": "Numeric"
525
+ },
526
+ "CEIL": {
527
+ "signature": "CEIL(n) / CEILING(n)",
528
+ "description": "Round up to the nearest integer.",
529
+ "type": "function",
530
+ "module": "Numeric"
531
+ },
532
+ "FLOOR": {
533
+ "signature": "FLOOR(n)",
534
+ "description": "Round down to the nearest integer.",
535
+ "type": "function",
536
+ "module": "Numeric"
537
+ },
538
+ "ROUND": {
539
+ "signature": "ROUND(n [, decimals])",
540
+ "description": "Round to a specified number of decimal places.",
541
+ "type": "function",
542
+ "module": "Numeric"
543
+ },
544
+ "TRUNC": {
545
+ "signature": "TRUNC(n [, decimals])",
546
+ "description": "Truncate to a specified number of decimal places.",
547
+ "type": "function",
548
+ "module": "Numeric"
549
+ },
550
+ "MOD": {
551
+ "signature": "MOD(dividend, divisor)",
552
+ "description": "Return the remainder of division.",
553
+ "type": "function",
554
+ "module": "Numeric"
555
+ },
556
+ "POWER": {
557
+ "signature": "POWER(base, exponent)",
558
+ "description": "Raise a number to a power.",
559
+ "type": "function",
560
+ "module": "Numeric"
561
+ },
562
+ "SQRT": {
563
+ "signature": "SQRT(n)",
564
+ "description": "Return the square root.",
565
+ "type": "function",
566
+ "module": "Numeric"
567
+ },
568
+ "LOG": {
569
+ "signature": "LOG(base, n)",
570
+ "description": "Return the logarithm of a number.",
571
+ "type": "function",
572
+ "module": "Numeric"
573
+ },
574
+ "LN": {
575
+ "signature": "LN(n)",
576
+ "description": "Return the natural logarithm (base e).",
577
+ "type": "function",
578
+ "module": "Numeric"
579
+ },
580
+ "EXP": {
581
+ "signature": "EXP(n)",
582
+ "description": "Return e raised to a power.",
583
+ "type": "function",
584
+ "module": "Numeric"
585
+ },
586
+ "SIGN": {
587
+ "signature": "SIGN(n)",
588
+ "description": "Return -1, 0, or 1 indicating the sign.",
589
+ "type": "function",
590
+ "module": "Numeric"
591
+ },
592
+ "GREATEST": {
593
+ "signature": "GREATEST(value1, value2, ...)",
594
+ "description": "Return the largest of the given values.",
595
+ "type": "function",
596
+ "module": "Numeric"
597
+ },
598
+ "LEAST": {
599
+ "signature": "LEAST(value1, value2, ...)",
600
+ "description": "Return the smallest of the given values.",
601
+ "type": "function",
602
+ "module": "Numeric"
603
+ },
604
+ "RANDOM": {
605
+ "signature": "RANDOM()",
606
+ "description": "Return a random value between 0 and 1 (PostgreSQL).",
607
+ "type": "function",
608
+ "module": "Numeric"
609
+ },
610
+ "CASE": {
611
+ "signature": "CASE WHEN condition THEN result [WHEN ...] [ELSE default] END",
612
+ "description": "Evaluate conditions and return the first matching result.",
613
+ "type": "expression",
614
+ "module": "Conditional"
615
+ },
616
+ "COALESCE": {
617
+ "signature": "COALESCE(value1, value2, ...)",
618
+ "description": "Return the first non-null value.",
619
+ "type": "function",
620
+ "module": "Conditional"
621
+ },
622
+ "NULLIF": {
623
+ "signature": "NULLIF(value1, value2)",
624
+ "description": "Return NULL if value1 equals value2.",
625
+ "type": "function",
626
+ "module": "Conditional"
627
+ },
628
+ "IFNULL": {
629
+ "signature": "IFNULL(expression, alternative)",
630
+ "description": "Return alternative if expression is NULL (MySQL).",
631
+ "type": "function",
632
+ "module": "Conditional"
633
+ },
634
+ "NVL": {
635
+ "signature": "NVL(expression, alternative)",
636
+ "description": "Return alternative if expression is NULL (Oracle).",
637
+ "type": "function",
638
+ "module": "Conditional"
639
+ },
640
+ "IIF": {
641
+ "signature": "IIF(condition, true_value, false_value)",
642
+ "description": "Inline conditional expression (SQL Server).",
643
+ "type": "function",
644
+ "module": "Conditional"
645
+ },
646
+ "CAST": {
647
+ "signature": "CAST(expression AS data_type)",
648
+ "description": "Convert a value to a specified data type.",
649
+ "type": "function",
650
+ "module": "Type"
651
+ },
652
+ "CONVERT": {
653
+ "signature": "CONVERT(expression, type) / CONVERT(type, expression)",
654
+ "description": "Convert a value to a specified type (MySQL / SQL Server).",
655
+ "type": "function",
656
+ "module": "Type"
657
+ },
658
+ "JSON_EXTRACT": {
659
+ "signature": "JSON_EXTRACT(json, path)",
660
+ "description": "Extract a value from a JSON document (MySQL).",
661
+ "type": "function",
662
+ "module": "JSON"
663
+ },
664
+ "JSON_OBJECT": {
665
+ "signature": "JSON_OBJECT(key, value, ...)",
666
+ "description": "Create a JSON object.",
667
+ "type": "function",
668
+ "module": "JSON"
669
+ },
670
+ "JSON_ARRAY": {
671
+ "signature": "JSON_ARRAY(values ...)",
672
+ "description": "Create a JSON array.",
673
+ "type": "function",
674
+ "module": "JSON"
675
+ },
676
+ "JSON_SET": {
677
+ "signature": "JSON_SET(json, path, value, ...)",
678
+ "description": "Set values in a JSON document (MySQL).",
679
+ "type": "function",
680
+ "module": "JSON"
681
+ },
682
+ "JSON_REMOVE": {
683
+ "signature": "JSON_REMOVE(json, path, ...)",
684
+ "description": "Remove keys from a JSON document (MySQL).",
685
+ "type": "function",
686
+ "module": "JSON"
687
+ },
688
+ "JSON_BUILD_OBJECT": {
689
+ "signature": "JSON_BUILD_OBJECT(key1, value1, ...)",
690
+ "description": "Build a JSON object from key-value pairs (PostgreSQL).",
691
+ "type": "function",
692
+ "module": "JSON"
693
+ },
694
+ "JSON_EACH": {
695
+ "signature": "JSON_EACH(json)",
696
+ "description": "Expand the outermost JSON object into key-value pairs (PostgreSQL).",
697
+ "type": "function",
698
+ "module": "JSON"
699
+ },
700
+ "JSON_TYPEOF": {
701
+ "signature": "JSON_TYPEOF(json)",
702
+ "description": "Return the type of a JSON value as text (PostgreSQL).",
703
+ "type": "function",
704
+ "module": "JSON"
705
+ },
706
+ "JSON_ARRAY_LENGTH": {
707
+ "signature": "JSON_ARRAY_LENGTH(json_array)",
708
+ "description": "Return the number of elements in a JSON array (PostgreSQL).",
709
+ "type": "function",
710
+ "module": "JSON"
435
711
  },
436
712
  "BEGIN": {
437
- "signature": "BEGIN [TRANSACTION | WORK]",
438
- "description": "Starts a new transaction. All subsequent statements are part of the transaction until COMMIT or ROLLBACK is issued.",
439
- "type": "keyword",
440
- "module": "TCL"
713
+ "signature": "BEGIN [WORK | TRANSACTION] [ISOLATION LEVEL ...]",
714
+ "description": "Start a new transaction.",
715
+ "type": "statement",
716
+ "module": "Transaction"
441
717
  },
442
718
  "COMMIT": {
443
- "signature": "COMMIT [WORK]",
444
- "description": "Saves all changes made during the current transaction permanently to the database. Releases any locks held by the transaction.",
445
- "type": "keyword",
446
- "module": "TCL"
719
+ "signature": "COMMIT [WORK | TRANSACTION]",
720
+ "description": "Save all changes made during the current transaction.",
721
+ "type": "statement",
722
+ "module": "Transaction"
447
723
  },
448
724
  "ROLLBACK": {
449
- "signature": "ROLLBACK [WORK] [TO SAVEPOINT savepoint_name]",
450
- "description": "Undoes all changes made during the current transaction, or rolls back to a specific savepoint. Releases locks held by the transaction.",
451
- "type": "keyword",
452
- "module": "TCL"
725
+ "signature": "ROLLBACK [WORK | TRANSACTION] [TO SAVEPOINT name]",
726
+ "description": "Undo all changes made during the current transaction.",
727
+ "type": "statement",
728
+ "module": "Transaction"
729
+ },
730
+ "SAVEPOINT": {
731
+ "signature": "SAVEPOINT name",
732
+ "description": "Create a named point within a transaction to partially roll back to.",
733
+ "type": "statement",
734
+ "module": "Transaction"
735
+ },
736
+ "RELEASE SAVEPOINT": {
737
+ "signature": "RELEASE SAVEPOINT name",
738
+ "description": "Release a previously defined savepoint.",
739
+ "type": "statement",
740
+ "module": "Transaction"
453
741
  },
454
742
  "GRANT": {
455
- "signature": "GRANT privilege_type ON object TO user [WITH GRANT OPTION]",
456
- "description": "Grants specific privileges (SELECT, INSERT, UPDATE, DELETE, ALL) on database objects to users or roles. WITH GRANT OPTION allows the user to grant the same privilege to others.",
457
- "type": "keyword",
743
+ "signature": "GRANT privileges ON object TO role [WITH GRANT OPTION]",
744
+ "description": "Grant permissions on database objects.",
745
+ "type": "statement",
458
746
  "module": "DCL"
459
747
  },
460
748
  "REVOKE": {
461
- "signature": "REVOKE privilege_type ON object FROM user",
462
- "description": "Removes previously granted privileges from a user or role.",
463
- "type": "keyword",
749
+ "signature": "REVOKE privileges ON object FROM role [CASCADE | RESTRICT]",
750
+ "description": "Remove permissions from a role.",
751
+ "type": "statement",
464
752
  "module": "DCL"
465
753
  },
754
+ "UNION": {
755
+ "signature": "query1 UNION [ALL] query2",
756
+ "description": "Combine result sets of two queries, removing duplicates.",
757
+ "type": "operator",
758
+ "module": "Set"
759
+ },
760
+ "UNION ALL": {
761
+ "signature": "query1 UNION ALL query2",
762
+ "description": "Combine result sets of two queries, keeping all rows.",
763
+ "type": "operator",
764
+ "module": "Set"
765
+ },
766
+ "INTERSECT": {
767
+ "signature": "query1 INTERSECT query2",
768
+ "description": "Return rows present in both result sets.",
769
+ "type": "operator",
770
+ "module": "Set"
771
+ },
772
+ "EXCEPT": {
773
+ "signature": "query1 EXCEPT query2",
774
+ "description": "Return rows in the first result set but not in the second.",
775
+ "type": "operator",
776
+ "module": "Set"
777
+ },
778
+ "WITH": {
779
+ "signature": "WITH cte_name AS (query) SELECT ...",
780
+ "description": "Define a Common Table Expression (CTE).",
781
+ "type": "clause",
782
+ "module": "CTE"
783
+ },
784
+ "WITH RECURSIVE": {
785
+ "signature": "WITH RECURSIVE cte_name AS (base UNION ALL recursive) SELECT ...",
786
+ "description": "Define a recursive Common Table Expression for hierarchical queries.",
787
+ "type": "clause",
788
+ "module": "CTE"
789
+ },
466
790
  "EXPLAIN": {
467
- "signature": "EXPLAIN [ANALYZE] query",
468
- "description": "Displays the query execution plan used by the database optimizer. EXPLAIN ANALYZE actually executes the query and shows real timing data. Essential for performance tuning.",
469
- "type": "keyword",
791
+ "signature": "EXPLAIN [ANALYZE] [VERBOSE] query",
792
+ "description": "Display the execution plan for a query.",
793
+ "type": "statement",
470
794
  "module": "Utility"
795
+ },
796
+ "VACUUM": {
797
+ "signature": "VACUUM [FULL] [ANALYZE] [table]",
798
+ "description": "Reclaim storage and optionally update planner statistics (PostgreSQL).",
799
+ "type": "statement",
800
+ "module": "Utility"
801
+ },
802
+ "CLUSTER": {
803
+ "signature": "CLUSTER table USING index",
804
+ "description": "Physically reorder table rows according to an index (PostgreSQL).",
805
+ "type": "statement",
806
+ "module": "Utility"
807
+ },
808
+ "REINDEX": {
809
+ "signature": "REINDEX {TABLE|INDEX|DATABASE} name",
810
+ "description": "Rebuild one or more indexes.",
811
+ "type": "statement",
812
+ "module": "Utility"
813
+ },
814
+ "COPY": {
815
+ "signature": "COPY table [(columns)] {FROM|TO} 'file' [WITH options]",
816
+ "description": "Bulk-load or export data between a table and a file (PostgreSQL).",
817
+ "type": "statement",
818
+ "module": "Utility"
819
+ },
820
+ "PREPARE": {
821
+ "signature": "PREPARE name [(type, ...)] AS query",
822
+ "description": "Create a prepared (parameterized) statement.",
823
+ "type": "statement",
824
+ "module": "Utility"
825
+ },
826
+ "EXECUTE": {
827
+ "signature": "EXECUTE name [(params)]",
828
+ "description": "Execute a prepared statement.",
829
+ "type": "statement",
830
+ "module": "Utility"
831
+ },
832
+ "DEALLOCATE": {
833
+ "signature": "DEALLOCATE [PREPARE] name",
834
+ "description": "Remove a prepared statement.",
835
+ "type": "statement",
836
+ "module": "Utility"
837
+ },
838
+ "LOCK TABLE": {
839
+ "signature": "LOCK TABLE name IN mode MODE",
840
+ "description": "Acquire a table-level lock.",
841
+ "type": "statement",
842
+ "module": "Utility"
843
+ },
844
+ "PRIMARY KEY": {
845
+ "signature": "column type PRIMARY KEY | CONSTRAINT name PRIMARY KEY (columns)",
846
+ "description": "A column or set of columns that uniquely identifies each row.",
847
+ "type": "constraint",
848
+ "module": "Constraint"
849
+ },
850
+ "FOREIGN KEY": {
851
+ "signature": "FOREIGN KEY (column) REFERENCES parent(column) [ON DELETE action] [ON UPDATE action]",
852
+ "description": "A column that references a primary key in another table.",
853
+ "type": "constraint",
854
+ "module": "Constraint"
855
+ },
856
+ "UNIQUE": {
857
+ "signature": "column type UNIQUE | CONSTRAINT name UNIQUE (columns)",
858
+ "description": "Ensure all values in a column (or combination) are distinct.",
859
+ "type": "constraint",
860
+ "module": "Constraint"
861
+ },
862
+ "CHECK": {
863
+ "signature": "CHECK (condition) | CONSTRAINT name CHECK (condition)",
864
+ "description": "Ensure column values satisfy a boolean expression.",
865
+ "type": "constraint",
866
+ "module": "Constraint"
867
+ },
868
+ "NOT NULL": {
869
+ "signature": "column type NOT NULL",
870
+ "description": "Ensure a column cannot contain NULL values.",
871
+ "type": "constraint",
872
+ "module": "Constraint"
873
+ },
874
+ "DEFAULT": {
875
+ "signature": "column type DEFAULT value",
876
+ "description": "Specify a default value for a column when none is provided.",
877
+ "type": "constraint",
878
+ "module": "Constraint"
879
+ },
880
+ "INTEGER": {
881
+ "signature": "INTEGER / INT",
882
+ "description": "A signed 4-byte integer (-2147483648 to 2147483647).",
883
+ "type": "type",
884
+ "module": "Data Type"
885
+ },
886
+ "BIGINT": {
887
+ "signature": "BIGINT",
888
+ "description": "A signed 8-byte integer.",
889
+ "type": "type",
890
+ "module": "Data Type"
891
+ },
892
+ "SMALLINT": {
893
+ "signature": "SMALLINT",
894
+ "description": "A signed 2-byte integer.",
895
+ "type": "type",
896
+ "module": "Data Type"
897
+ },
898
+ "SERIAL": {
899
+ "signature": "SERIAL",
900
+ "description": "Auto-incrementing 4-byte integer (PostgreSQL shorthand for INTEGER + sequence).",
901
+ "type": "type",
902
+ "module": "Data Type"
903
+ },
904
+ "BIGSERIAL": {
905
+ "signature": "BIGSERIAL",
906
+ "description": "Auto-incrementing 8-byte integer (PostgreSQL).",
907
+ "type": "type",
908
+ "module": "Data Type"
909
+ },
910
+ "VARCHAR": {
911
+ "signature": "VARCHAR(n)",
912
+ "description": "Variable-length character string with a maximum length.",
913
+ "type": "type",
914
+ "module": "Data Type"
915
+ },
916
+ "TEXT": {
917
+ "signature": "TEXT",
918
+ "description": "Variable-length character string with unlimited length.",
919
+ "type": "type",
920
+ "module": "Data Type"
921
+ },
922
+ "CHAR": {
923
+ "signature": "CHAR(n)",
924
+ "description": "Fixed-length character string, padded with spaces.",
925
+ "type": "type",
926
+ "module": "Data Type"
927
+ },
928
+ "BOOLEAN": {
929
+ "signature": "BOOLEAN",
930
+ "description": "True/false value.",
931
+ "type": "type",
932
+ "module": "Data Type"
933
+ },
934
+ "DATE": {
935
+ "signature": "DATE",
936
+ "description": "Calendar date (year, month, day).",
937
+ "type": "type",
938
+ "module": "Data Type"
939
+ },
940
+ "TIMESTAMP": {
941
+ "signature": "TIMESTAMP [(precision)] [WITHOUT TIME ZONE]",
942
+ "description": "Date and time without time zone.",
943
+ "type": "type",
944
+ "module": "Data Type"
945
+ },
946
+ "TIMESTAMPTZ": {
947
+ "signature": "TIMESTAMP WITH TIME ZONE",
948
+ "description": "Date and time with time zone (PostgreSQL alias TIMESTAMPTZ).",
949
+ "type": "type",
950
+ "module": "Data Type"
951
+ },
952
+ "NUMERIC": {
953
+ "signature": "NUMERIC(precision, scale)",
954
+ "description": "Exact numeric with user-specified precision.",
955
+ "type": "type",
956
+ "module": "Data Type"
957
+ },
958
+ "DECIMAL": {
959
+ "signature": "DECIMAL(precision, scale)",
960
+ "description": "Exact numeric type, synonym for NUMERIC.",
961
+ "type": "type",
962
+ "module": "Data Type"
963
+ },
964
+ "FLOAT": {
965
+ "signature": "FLOAT [(precision)]",
966
+ "description": "Approximate numeric, IEEE 754 double precision.",
967
+ "type": "type",
968
+ "module": "Data Type"
969
+ },
970
+ "REAL": {
971
+ "signature": "REAL",
972
+ "description": "Single-precision floating-point number.",
973
+ "type": "type",
974
+ "module": "Data Type"
975
+ },
976
+ "UUID": {
977
+ "signature": "UUID",
978
+ "description": "128-bit universally unique identifier.",
979
+ "type": "type",
980
+ "module": "Data Type"
981
+ },
982
+ "JSON": {
983
+ "signature": "JSON",
984
+ "description": "Textual JSON data (validated on input).",
985
+ "type": "type",
986
+ "module": "Data Type"
987
+ },
988
+ "JSONB": {
989
+ "signature": "JSONB",
990
+ "description": "Binary JSON data with indexing support (PostgreSQL).",
991
+ "type": "type",
992
+ "module": "Data Type"
993
+ },
994
+ "ARRAY": {
995
+ "signature": "type[] | ARRAY[values]",
996
+ "description": "A multi-dimensional array of values (PostgreSQL).",
997
+ "type": "type",
998
+ "module": "Data Type"
999
+ },
1000
+ "BYTEA": {
1001
+ "signature": "BYTEA",
1002
+ "description": "Binary data ('byte array') (PostgreSQL).",
1003
+ "type": "type",
1004
+ "module": "Data Type"
1005
+ },
1006
+ "INTERVAL": {
1007
+ "signature": "INTERVAL [fields]",
1008
+ "description": "A span of time.",
1009
+ "type": "type",
1010
+ "module": "Data Type"
1011
+ },
1012
+ "INET": {
1013
+ "signature": "INET",
1014
+ "description": "IPv4 or IPv6 host address (PostgreSQL).",
1015
+ "type": "type",
1016
+ "module": "Data Type"
1017
+ },
1018
+ "CIDR": {
1019
+ "signature": "CIDR",
1020
+ "description": "IPv4 or IPv6 network address (PostgreSQL).",
1021
+ "type": "type",
1022
+ "module": "Data Type"
1023
+ },
1024
+ "ENUM": {
1025
+ "signature": "CREATE TYPE name AS ENUM ('v1', 'v2', ...)",
1026
+ "description": "An enumerated set of string values (PostgreSQL).",
1027
+ "type": "type",
1028
+ "module": "Data Type"
1029
+ },
1030
+ "LIKE": {
1031
+ "signature": "expression LIKE pattern [ESCAPE escape_char]",
1032
+ "description": "Pattern matching. % matches any sequence; _ matches any single character.",
1033
+ "type": "predicate",
1034
+ "module": "DML"
1035
+ },
1036
+ "ILIKE": {
1037
+ "signature": "expression ILIKE pattern",
1038
+ "description": "Case-insensitive LIKE (PostgreSQL).",
1039
+ "type": "predicate",
1040
+ "module": "DML"
1041
+ },
1042
+ "BETWEEN": {
1043
+ "signature": "expression BETWEEN low AND high",
1044
+ "description": "Range test (inclusive). Equivalent to: expr >= low AND expr <= high.",
1045
+ "type": "predicate",
1046
+ "module": "DML"
1047
+ },
1048
+ "IN": {
1049
+ "signature": "expression IN (values | subquery)",
1050
+ "description": "Set membership test.",
1051
+ "type": "predicate",
1052
+ "module": "DML"
1053
+ },
1054
+ "EXISTS": {
1055
+ "signature": "EXISTS (subquery)",
1056
+ "description": "Returns TRUE if subquery returns at least one row.",
1057
+ "type": "predicate",
1058
+ "module": "DML"
1059
+ },
1060
+ "ANY": {
1061
+ "signature": "expression operator ANY (subquery | array)",
1062
+ "description": "Returns TRUE if comparison is true for any subquery row or array element.",
1063
+ "type": "predicate",
1064
+ "module": "DML"
1065
+ },
1066
+ "ALL": {
1067
+ "signature": "expression operator ALL (subquery)",
1068
+ "description": "Returns TRUE if comparison is true for all subquery rows.",
1069
+ "type": "predicate",
1070
+ "module": "DML"
1071
+ },
1072
+ "HAVING": {
1073
+ "signature": "HAVING condition",
1074
+ "description": "Filter grouped rows after GROUP BY. Used with aggregate functions.",
1075
+ "type": "clause",
1076
+ "module": "DML"
1077
+ },
1078
+ "CREATE ROLE": {
1079
+ "signature": "CREATE ROLE name [WITH option ...]",
1080
+ "description": "Create a new database role.",
1081
+ "type": "statement",
1082
+ "module": "DCL"
1083
+ },
1084
+ "ALTER ROLE": {
1085
+ "signature": "ALTER ROLE name [WITH option ...] | SET param",
1086
+ "description": "Modify role attributes or configuration.",
1087
+ "type": "statement",
1088
+ "module": "DCL"
1089
+ },
1090
+ "DROP ROLE": {
1091
+ "signature": "DROP ROLE [IF EXISTS] name",
1092
+ "description": "Remove a database role.",
1093
+ "type": "statement",
1094
+ "module": "DCL"
1095
+ },
1096
+ "CREATE DATABASE": {
1097
+ "signature": "CREATE DATABASE name [OWNER = role] [ENCODING = enc]",
1098
+ "description": "Create a new database.",
1099
+ "type": "statement",
1100
+ "module": "DDL"
1101
+ },
1102
+ "DROP DATABASE": {
1103
+ "signature": "DROP DATABASE [IF EXISTS] name",
1104
+ "description": "Delete a database.",
1105
+ "type": "statement",
1106
+ "module": "DDL"
1107
+ },
1108
+ "GENERATE_SERIES": {
1109
+ "signature": "generate_series(start, stop [, step])",
1110
+ "description": "Generate a series of values from start to stop with optional step.",
1111
+ "type": "function",
1112
+ "module": "Set-returning"
1113
+ },
1114
+ "UNNEST": {
1115
+ "signature": "unnest(anyarray)",
1116
+ "description": "Expand an array to a set of rows.",
1117
+ "type": "function",
1118
+ "module": "Array"
1119
+ },
1120
+ "GEN_RANDOM_UUID": {
1121
+ "signature": "gen_random_uuid() → uuid",
1122
+ "description": "Generate a random UUID v4 (PostgreSQL 13+).",
1123
+ "type": "function",
1124
+ "module": "Crypto"
1125
+ },
1126
+ "MD5": {
1127
+ "signature": "md5(string) → text",
1128
+ "description": "Calculate MD5 hash of string, returning hex.",
1129
+ "type": "function",
1130
+ "module": "Crypto"
1131
+ },
1132
+ "PERCENTILE_CONT": {
1133
+ "signature": "percentile_cont(fraction) WITHIN GROUP (ORDER BY column)",
1134
+ "description": "Calculate continuous percentile (interpolated).",
1135
+ "type": "function",
1136
+ "module": "Aggregate"
1137
+ },
1138
+ "PERCENTILE_DISC": {
1139
+ "signature": "percentile_disc(fraction) WITHIN GROUP (ORDER BY column)",
1140
+ "description": "Calculate discrete percentile (actual value from set).",
1141
+ "type": "function",
1142
+ "module": "Aggregate"
471
1143
  }
472
1144
  }
473
1145
  }