Help Center/
CloudTable Service/
User Guide/
Using Doris/
Common SQL Commands of Doris/
Querying Data
Updated on 2025-07-24 GMT+08:00
Querying Data
This section describes the basic syntax and usage of the SQL statements for querying table data in a Doris cluster.
Basic Syntax
SELECT [hint_statement, ...] [ALL | DISTINCT | DISTINCTROW | ALL EXCEPT ( col_name1 [, col_name2, col_name3, ...] )] select_expr [, select_expr ...] [FROM table_references [PARTITION partition_list] [TABLET tabletid_list] [TABLESAMPLE sample_value [ROWS | PERCENT] [REPEATABLE pos_seek]] [WHERE where_condition] [GROUP BY [GROUPING SETS | ROLLUP | CUBE] {col_name | expr | position}] [HAVING where_condition] [ORDER BY {col_name | expr | position} [ASC | DESC], ...] [LIMIT {[offset,] row_count | row_count OFFSET offset}] [INTO OUTFILE 'file_name']
Usage Example
- Query the names of students aged 18, 20, and 25 in the student table.
SELECT Name from student where age in (18,20,25);
- Query the names of the three youngest students in the student table. Use order by to sort the age column and use limit to display three records. asc indicates the ascending order (default), and desc indicates the descending order.
SELECT Name from student order by age asc limit 3;
Parent topic: Common SQL Commands of Doris
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot