sql-bricks | Transparent , Schemaless SQL Generation | SQL Database library
kandi X-RAY | sql-bricks Summary
kandi X-RAY | sql-bricks Summary
SQL Bricks.js is a transparent, schemaless library for building and composing SQL statements.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Convert the arguments object to a sql query .
- Inherit a callback function .
- Escapes a literal expression to a given expression .
- Convert a column or column into a SQL statement
- Convert value to a SQL statement .
- The value is replaced .
- Represents a binary operation .
- convert arguments to an array
- Extend other objects
- Insert values into table .
sql-bricks Key Features
sql-bricks Examples and Code Snippets
Community Discussions
Trending Discussions on sql-bricks
QUESTION
I want to create a SQL query to select all records where values are in an array of strings. say I have the following array
myarray = ['a', 'b', 'c']
I want to use this to construct a query like this
SELECT * FROM my_table WHERE mycol IN ('a', 'b', 'c')
Regular string interpolation obviously does not work for this. I even tried sql-bricks but apparently it does not support IN with WHERE.
Is there a good way to use arrays in SQL queries?
...ANSWER
Answered 2019-Oct-10 at 14:08let sql = `SELECT * FROM my_table WHERE mycol IN ('${ myarray.join("','") }');`
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sql-bricks
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page