You can execute the SHOW TABLES statement to list the names of tables in the current database.
For more information about the SHOW TABLES statement, see List mapping table names.
Prerequisites
- A Tablestore client is initialized. For more information, see Initialize an OTSClient instance.
- A mapping table is created. For more information, see Create mapping tables.
Parameters
Parameter | Description |
query | The SQL statement. Configure this parameter based on the required feature. |
Example
The following sample code provides an example on how to execute the SHOW TABLES
statement to list the names of mapping tables:
const params = {
query: "show tables",
}
client.sqlQuery(params, function (err, data) {
if (err) {
console.log('sqlQuery error:', err.toString());
} else {
console.log('sqlQuery success:', data);
}
});
References
After you list the names of the mapping tables, perform operations based on your business requirements.
To use a mapping table to query data that meets specific conditions, execute the
SELECT
statement. For more information, see Query data.To query the details of a mapping table, such as field names and field types, execute the
DESCRIBE
statement. For more information, see Query information about tables.To update the attribute column of a mapping table after an attribute column of the data table is changed, execute the
ALTER TABLE
statement. For more information, see Update attribute columns of a mapping table.To delete a mapping table, execute the
DROP MAPPING TABLE
statement. For more information, see Delete mapping tables.