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 PHP when SQL statements are executed.

Usage notes

Tablestore SDK for PHP V5.1.0 or later supports the SQL query feature. Before you use the SQL query feature, make sure that Tablestore SDK for PHP V5.1.0 or later is obtained. For information about the versions of Tablestore SDK for PHP, see Version history of Tablestore SDK for PHP.

Procedure

To use the SQL query feature, 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 from which you want to query data. For more information, see Create mapping tables.

    After you create a mapping table, you can manage the mapping table based on your business requirements.

    Operation

    Description

    Update attribute columns of a mapping table

    You can execute the ALTER TABLE statement to add or remove attribute columns in an existing 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 tables

    You can execute the DESCRIBE statement to query information about a table, 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 a table.

    Delete mapping tables

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

  2. You can execute the SELECT statement 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.