All Products
Search
Document Center

Tablestore:SQL query

Last Updated:Aug 02, 2024

This topic describes how to perform SQL queries by using Tablestore SDK for .NET.

Usage notes

Tablestore SDK for .NET V5.0.0 or later supports SQL queries. To perform SQL queries by using Tablestore SDK for .NET, make sure that your SDK version is 5.0.0 or later. We recommend that you use the latest SDK. For more information, see Version history of Tablestore SDK for .NET.

Procedure

You must use the following steps to perform SQL queries.

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 more information, see Create a mapping table.

    You can manage mapping tables based on your actual requirements. The following table describes the mapping management operations that you can perform.

    Operation

    Description

    Update attribute columns of mapping tables

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

    Query the names of tables

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

    Query information about tables

    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.