The query()
function is executed on a data source connected to MindsDB and saved into a variable. It queries a table from this data source.
Syntax
Here is the syntax:
/**
* Create a new Query object
*
* @param sql - SQL query string
* @return Query object
*/
public Query query(String sql);
Example
Database mariadb = server.getDatabase("mariadb");
Query query = mariadb.query("SELECT * FROM my_table");
Table queryResponse = query.fetch();
System.out.println(queryResponse);