Help Center/ GaussDB/ Developer Guide(Distributed_V2.0-8.x)/ SQL Reference/ SQL Syntax/ S/ SELECT/ Conditional Queries
Updated on 2025-08-19 GMT+08:00
Conditional Queries
A conditional query retrieves data that meets the conditions.
The following example demonstrates a typical conditional query that displays the query results in a specified table based on specific query conditions:
-- Create a table and insert data into the table. gaussdb=# CREATE TABLE test_grade( id INT, name VARCHAR(20), score FLOAT -- Score ); gaussdb=# INSERT INTO test_grade VALUES (1,'Scott',90),(2,'Jack',87.5),(3,'Ben',48); -- Query information about students who fail to pass the test. gaussdb=# SELECT * FROM test_grade WHERE score < 60; id | name | score ----+------+------- 3 | Ben | 48 (1 row) -- Drop. gaussdb=# DROP TABLE test_grade;
Parent topic: SELECT
What is your overall rating for this page?
0
1
2
3
4
5
6
7
8
9
10
Very dissatisfiedVery satisfied
Thank you very much for your feedback. We will continue working to improve the documentation.
The system is busy. Please try again later.