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. This package provides a set of functions to generate SQL commands for creating tables, inserting data, and performing various operations, including text search and matching, on SQL databases (currently PostgreSQL).
2+
3+ 📦 [ Node.js] ( https://www.npmjs.com/package/extra-sql ) ,
4+ 🌐 [ Web] ( https://www.npmjs.com/package/extra-sql.web ) ,
5+ 📜 [ Files] ( https://unpkg.com/extra-sql/ ) ,
6+ 📰 [ Docs] ( https://nodef.github.io/extra-sql/ ) ,
7+ 📘 [ Wiki] ( https://github.com/nodef/extra-sql/wiki/ ) .
8+
9+ <br >
10+
311
412``` javascript
5- const sql = require (' extra-sql' );
13+ const xsql = require (' extra-sql' );
614
7- sql .tableExists (' food' );
8- // SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name='food');
15+ xsql .tableExists (' food' );
16+ // → SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name='food');
917
10- sql .setupTable (' food' , {code: ' TEXT' , name: ' TEXT' },
18+ xsql .setupTable (' food' , {code: ' TEXT' , name: ' TEXT' },
1119 [{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');
20+ // → CREATE TABLE IF NOT EXISTS "food" ("code" TEXT, "name" TEXT);
21+ // → INSERT INTO "food" ("code", "name") VALUES
22+ // → ('F1', 'Mango'),
23+ // → ('F2', 'Lychee');
1624
17- sql .selectTsquery (' columns' , ' total fat' );
18- // SELECT * FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat');
25+ xsql .selectTsquery (' columns' , ' total fat' );
26+ // → SELECT * FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat');
1927
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');
28+ xsql .matchTsquery (' columns' , [' total' , ' fat' ]);
29+ // → SELECT *, '2'::INT AS "matchTsquery" FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total fat') UNION ALL
30+ // → SELECT *, '1'::INT AS "matchTsquery" FROM "columns" WHERE "tsvector" @@ plainto_tsquery('total');
2331```
2432
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}
33+
34+ ## Index
35+
36+ | Property | Description |
37+ | ---- | ---- |
38+ | [ createTable] | Generate SQL command for CREATE TABLE. |
39+ | [ createIndex] | Generate SQL command for CREATE INDEX. |
40+ | [ createView] | Generate SQL command for CREATE VIEW. |
41+ | [ insertInto] | Generates SQL command for INSERT INTO using an array of values. |
42+ | [ setupTable] | Generate SQL commands to set up a table (create, insert, index). |
43+ | [ tableExists] | Generate SQL command to check if a table exists. |
44+ | [ selectTsquery] | Generate SQL command for SELECT with tsquery. |
45+ | [ matchTsquery] | Generate SQL query for matching words with tsquery. |
46+ | [ insertIntoStream] | Generate SQL command for INSERT INTO using a stream of values. |
47+ | [ setupTableIndex] | Generate SQL commands for setting up table indexes and views. |
48+ | [ createTableData] | Generate SQL command for creating a table with data. |
49+ | [ updateData] | Generate SQL command for updating data. |
50+ | [ selectData] | Generate SQL command for selecting data. |
51+ | [ insertIntoData] | Generate SQL command for inserting data. |
52+ | [ deleteData] | Generate SQL command for deleting data. |
53+ | [ OPERATORS] | Set of operators in SQL. {field} |
54+ | [ OPERAND_COUNT] | Number of operands used with an SQL operator. {field} |
3955
4056<br >
4157<br >
4258
43- [ ![ nodef] ( https://merferry.glitch.me/card/extra-sql.svg )] ( https://nodef.github.io )
4459
60+ [ ![ ] ( https://img.youtube.com/vi/u6EuAUjq92k/maxresdefault.jpg )] ( https://www.youtube.com/watch?v=u6EuAUjq92k ) <br >
61+ [ ![ ORG] ( https://img.shields.io/badge/org-nodef-green?logo=Org )] ( https://nodef.github.io )
62+
63+
64+ [ SQL ] : https://en.wikipedia.org/wiki/SQL
4565[ createTable ] : https://github.com/nodef/extra-sql/wiki/createTable
4666[ createIndex ] : https://github.com/nodef/extra-sql/wiki/createIndex
4767[ createView ] : https://github.com/nodef/extra-sql/wiki/createView
@@ -52,4 +72,10 @@ sql.matchTsquery('columns', ['total', 'fat']);
5272[ matchTsquery ] : https://github.com/nodef/extra-sql/wiki/matchTsquery
5373[ OPERATORS ] : https://github.com/nodef/extra-sql/wiki/OPERATORS
5474[ OPERAND_COUNT ] : https://github.com/nodef/extra-sql/wiki/OPERAND_COUNT
55- [ SQL ] : https://en.wikipedia.org/wiki/SQL
75+ [ insertIntoStream ] : https://github.com/nodef/extra-sql/wiki/insertIntoStream
76+ [ setupTableIndex ] : https://github.com/nodef/extra-sql/wiki/setupTableIndex
77+ [ createTableData ] : https://github.com/nodef/extra-sql/wiki/createTableData
78+ [ updateData ] : https://github.com/nodef/extra-sql/wiki/updateData
79+ [ selectData ] : https://github.com/nodef/extra-sql/wiki/selectData
80+ [ insertIntoData ] : https://github.com/nodef/extra-sql/wiki/insertIntoData
81+ [ deleteData ] : https://github.com/nodef/extra-sql/wiki/deleteData
0 commit comments