You can execute the create table statement to create a mapping table for an existing table or search index.
Prerequisites
A Tablestore client is initialized. For more information, see Initialization.
Usage notes
Tablestore SDK for Java V5.13.0 or later supports the SQL query feature. Before you use the SQL query feature, make sure that Tablestore SDK for Java V5.13.0 or later is obtained. For more information about the version history of Tablestore SDK for Java, see Tablestore SDK for Java.
Parameters
Parameter | Description |
---|---|
query | The SQL statement. Configure the parameter based on the required feature. |
Example
Execute the create table test_table (pk varchar(1024), long_value bigint, double_value double, string_value mediumtext, bool_value bool, primary key(pk))
statement to create a mapping table for the table named test_table.
private static void createTable(SyncClient client) {
// Create a SQL request.
SQLQueryRequest request = new SQLQueryRequest("create table test_table (pk varchar(1024), long_value bigint, double_value double, string_value mediumtext, bool_value bool, primary key(pk))");
// Obtain the response to the SQL request.
SQLQueryResponse response = client.sqlQuery(request);
}