This Node.js application allows the manipulation of SQL queries dynamically, converting them into operations on an in-memory database. The application supports INSERT and SELECT operations and interacts with the user through a Command Line Interface (CLI) using the prompt-sync library.
- SQL Query Manipulation: The application accepts
INSERTandSELECTSQL queries, converting them into operations on the in-memory database. - In-Memory Database: It uses a JavaScript object as an in-memory database, enabling fast and efficient operations.
- Command Line Interface (CLI): Interacts with the user through a CLI, utilizing the
prompt-synclibrary to receive and present information.
-
Installation:
- Clone the repository.
- Run
npm installto install the dependencies.
-
Execution:
- Start the application with
npm run start. - The CLI will prompt you to enter a SQL query.
- Start the application with
-
Supported Operations:
- INSERT: To insert data into the in-memory database, input an
INSERTSQL query.
For example:INSERT INTO users (name, age) VALUES ('John Doe', 30). - SELECT: To retrieve data from the in-memory database, input a
SELECTSQL query.
For example:SELECT * FROM users WHERE age > 25.
- INSERT: To insert data into the in-memory database, input an
- Insert Data:
INSERT INTO users (name, age) VALUES ('Jane Doe', 28) - Retrieve Data:
SELECT * FROM users WHERE age > 25
- The application does not perform input validation or string escaping, so it's important to ensure that the entered SQL queries are secure to prevent SQL injection attacks.