1- [ SQL] is designed for managing or stream processing data in an RDBMS.
2- Includes SQL command generation functions, with a few for text matching (PostgreSQL).
1+ [ SQL] is designed for managing or stream processing data in an RDBMS. Includes SQL command generation functions, with a few for text matching (PostgreSQL).
32
43``` javascript
5- const sql = require (' extra-sql' );
4+ const xsql = require (' extra-sql' );
65
7- sql .tableExists (' food' );
8- // SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name='food');
6+ xsql .tableExists (' food' );
7+ // → SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name='food');
98
10- sql .setupTable (' food' , {code: ' TEXT' , name: ' TEXT' },
9+ xsql .setupTable (' food' , {code: ' TEXT' , name: ' TEXT' },
1110 [{code: ' F1' , name: ' Mango' }, {code: ' F2' , name: ' Lychee' }]);
12- // CREATE TABLE IF NOT EXISTS "food" ("code" TEXT, "name" TEXT);
13- // INSERT INTO "food" ("code", "name") VALUES
14- // ('F1', 'Mango'),
15- // ('F2', 'Lychee');
11+ // → CREATE TABLE IF NOT EXISTS "food" ("code" TEXT, "name" TEXT);
12+ // → INSERT INTO "food" ("code", "name") VALUES
13+ // → ('F1', 'Mango'),
14+ // → ('F2', 'Lychee');
1615
17- sql .selectTsquery (' columns' , ' total fat' );
18- // SELECT * FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat');
16+ xsql .selectTsquery (' columns' , ' total fat' );
17+ // → SELECT * FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat');
1918
20- sql .matchTsquery (' columns' , [' total' , ' fat' ]);
21- // SELECT *, '2'::INT AS "matchTsquery" FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat') UNION ALL
22- // SELECT *, '1'::INT AS "matchTsquery" FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total');
19+ xsql .matchTsquery (' columns' , [' total' , ' fat' ]);
20+ // → SELECT *, '2'::INT AS "matchTsquery" FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat') UNION ALL
21+ // → SELECT *, '1'::INT AS "matchTsquery" FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total');
2322```
2423
25- ### reference
26-
27- | Name | Action
28- |---------------------|-------
29- | [ createTable] | Generates SQL command for CREATE TABLE.
30- | [ createIndex] | Generates SQL command for CREATE INDEX.
31- | [ createView] | Generates SQL command for CREATE VIEW.
32- | [ insertInto] | Generates SQL command for INSERT INTO.
33- | [ setupTable] | Generates SQL commands to setup table (create, insert, index).
34- | [ tableExists] | Generates SQL command for table exists check.
35- | [ selectTsquery] | Generates SQL command for SELECT with tsquery.
36- | [ matchTsquery] | Generates SQL query for matching words with tsquery.
37- | [ OPERATORS] | Set of operators in SQL. {field}
38- | [ OPERAND_COUNT] | Number of operands used with an SQL operator. {field}
24+
25+ ## Index
26+
27+ | Property | Description |
28+ | ---- | ---- |
29+ | [ createTable] | Generate SQL command for CREATE TABLE. |
30+ | [ createIndex] | Generate SQL command for CREATE INDEX. |
31+ | [ createView] | Generate SQL command for CREATE VIEW. |
32+ | [ insertInto] | Generates SQL command for INSERT INTO using an array of values. |
33+ | [ setupTable] | Generate SQL commands to set up a table (create, insert, index). |
34+ | [ tableExists] | Generate SQL command to check if a table exists. |
35+ | [ selectTsquery] | Generate SQL command for SELECT with tsquery. |
36+ | [ matchTsquery] | Generate SQL query for matching words with tsquery. |
37+ | [ insertIntoStream] | Generate SQL command for INSERT INTO using a stream of values. |
38+ | [ setupTableIndex] | Generate SQL commands for setting up table indexes and views. |
39+ | [ createTableData] | Generate SQL command for creating a table with data. |
40+ | [ updateData] | Generate SQL command for updating data. |
41+ | [ selectData] | Generate SQL command for selecting data. |
42+ | [ insertIntoData] | Generate SQL command for inserting data. |
43+ | [ deleteData] | Generate SQL command for deleting data. |
44+ | [ OPERATORS] | Set of operators in SQL. {field} |
45+ | [ OPERAND_COUNT] | Number of operands used with an SQL operator. {field} |
3946
4047<br >
4148<br >
4249
43- [ ![ nodef] ( https://merferry.glitch.me/card/extra-sql.svg )] ( https://nodef.github.io )
4450
51+ [ ![ ] ( https://img.youtube.com/vi/u6EuAUjq92k/maxresdefault.jpg )] ( https://www.youtube.com/watch?v=u6EuAUjq92k ) <br >
52+ [ ![ ORG] ( https://img.shields.io/badge/org-nodef-green?logo=Org )] ( https://nodef.github.io )
53+
54+
55+ [ SQL ] : https://en.wikipedia.org/wiki/SQL
4556[ createTable ] : https://github.com/nodef/extra-sql/wiki/createTable
4657[ createIndex ] : https://github.com/nodef/extra-sql/wiki/createIndex
4758[ createView ] : https://github.com/nodef/extra-sql/wiki/createView
@@ -52,4 +63,10 @@ sql.matchTsquery('columns', ['total', 'fat']);
5263[ matchTsquery ] : https://github.com/nodef/extra-sql/wiki/matchTsquery
5364[ OPERATORS ] : https://github.com/nodef/extra-sql/wiki/OPERATORS
5465[ OPERAND_COUNT ] : https://github.com/nodef/extra-sql/wiki/OPERAND_COUNT
55- [ SQL ] : https://en.wikipedia.org/wiki/SQL
66+ [ insertIntoStream ] : https://github.com/nodef/extra-sql/wiki/insertIntoStream
67+ [ setupTableIndex ] : https://github.com/nodef/extra-sql/wiki/setupTableIndex
68+ [ createTableData ] : https://github.com/nodef/extra-sql/wiki/createTableData
69+ [ updateData ] : https://github.com/nodef/extra-sql/wiki/updateData
70+ [ selectData ] : https://github.com/nodef/extra-sql/wiki/selectData
71+ [ insertIntoData ] : https://github.com/nodef/extra-sql/wiki/insertIntoData
72+ [ deleteData ] : https://github.com/nodef/extra-sql/wiki/deleteData
0 commit comments