After you enter the SQL mode, you can execute SQL statements to query mapping tables that are created for data tables in an instance, query information about a mapping table, and query the data in a table.
Enter the SQL mode
Run the sql
command to enter the SQL mode.
Query mapping tables
Query the mapping tables that are created for tables in an instance.
Run the SHOW TABLES;
command to query the mapping tables that are created for tables in an instance.
The following result is returned:
+----------------------+
| Tables_in_myinstance |
+----------------------+
| mytable |
+----------------------+
| mytstable |
+----------------------+
| mytstable::meta |
+----------------------+
In the preceding command output, mytable is a mapping table that is created for a data table, mytstable is a mapping table that is created for a time series data table, and mytstable::meta is a mapping table that is created for a time series metadata table.
Query information about a mapping table
Query information about a mapping table.
Command syntax
DESCRIBE table_name;
Examples
The following sample code shows how to query the information about the mapping table named mytable:
DESCRIBE mytable;
The following result is returned:
+-------+---------------+------+-----+-------+ | Field | Type | Null | Key | Extra | +-------+---------------+------+-----+-------+ | uid | varchar(1024) | NO | PRI | | +-------+---------------+------+-----+-------+ | pid | bigint(20) | NO | PRI | | +-------+---------------+------+-----+-------+ | b | double | YES | | | +-------+---------------+------+-----+-------+ | c | tinyint(1) | YES | | | +-------+---------------+------+-----+-------+ | d | mediumtext | YES | | | +-------+---------------+------+-----+-------+
Query the data in a table
Query the data in a table by executing the SELECT statement.
Run the following command to query all time series data in the time series table named mytstable:
SELECT * FROM mytstable limit 10;
Exit the SQL mode
Run the exit;
command to exit the SQL mode.
FAQ
References
You can use the SQL query feature by using the Tablestore console, Tablestore SDKs, JDBC, and JDBC driver for Go.
If you want to accelerate data queries and computing by executing SQL statements, you can create a secondary index or a search index. For more information, see Index selection policy and Computing pushdown.
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.