All Products
Search
Document Center

Tablestore:SQL query

Last Updated:Nov 29, 2024

This topic describes the operations that are supported for Tablestore SDK for Node.js by executing SQL statements.

Usage notes

Tablestore SDK for Node.js V5.2.0 or later supports the SQL query feature. Before you use the SQL query feature, make sure that Tablestore SDK for Node.js V5.2.0 or later is obtained. For more information about the version history of Tablestore SDK for Node.js, see Version history of Tablestore SDK for Node.js.

Procedure

To use the SQL query feature to query data, perform the following steps.

Note

This topic describes how to execute SQL statements to perform operations on data in a data table. For information about how to execute SQL statements to perform operations on data in a time series table, see Use SQL to query time series data.

  1. Create a mapping table for the table. For more information, see Create mapping tables.

    After you create a mapping table, you can manage the mapping table as needed.

    Operation

    Description

    Update attribute columns of a mapping table

    You can execute the ALTER TABLE statement to add an attribute column to an existing mapping table or delete an attribute column from the mapping table.

    List the names of tables

    You can execute the SHOW TABLES statement to query the names of tables in the current database.

    Query information about a table

    You can execute the DESCRIBE statement to query the information about tables, such as the field names and field types.

    Query index information about tables

    You can execute the SHOW INDEX statement to query the index information about tables.

    Delete mapping tables

    You can execute the DROP MAPPING TABLE statement to delete mapping tables that are created for tables.

  2. Execute SELECT statements to query data. For more information, see Query data.

FAQ

How do I troubleshoot common errors of SQL queries?

References

  • For information about the SQL query feature, see SQL query.

  • For information about the API operation that you can call to use the SQL query feature, see SQLQuery.

  • You can also use computing engines, such as MaxCompute, Spark, Hive, HadoopMR, Function Compute, Flink, and PrestoDB, to compute and analyze data in tables. For more information, see Overview.