Hi Piyush,
I would suggest trying to make a
REST API that queries your database, and have D3 code connect to that API over HTTP. From the D3 code perspective, it would be just like loading a JSON file, but instead of fetching a file from disk, it would query your API instead. The API would need to be a server-side piece of code that executes some SQL query and returns the result to the browser in a format that is easy to parse in JavaScript (typically JSON or CSV). You should be able to call the REST API from your D3 code using the function d3.csv or d3.json. Perhaps it could return the entire table if it is small enough to fit in the browser, or perhaps the SQL query would need to do some filtering to make the data small enough to send to the browser.
Maybe as a first experiment, before creating a REST API, you can try extracting the data from the database into a CSV file. Here's a
thread that shows how to do this. Then your D3 code can load that CSV file. An easy way to maintain a service like this would be to have a script run periodically that extracts the data to a CSV file, but it would be better to make a REST API that queries the database on demand.
Best regards,
Curran