Help Center/
GaussDB/
M-Compatibility Developer Guide(Distributed)/
SQL Reference/
SQL Syntax/
SQL Statements/
S/
SELECT/
Conditional Queries
Updated on 2025-10-23 GMT+08:00
Conditional Queries
A conditional query retrieves data that meets the conditions.
-- Create a table and insert data into the table.
m_db=# CREATE TABLE test_grade(
id INT,
name VARCHAR(20),
score FLOAT -- Score
);
m_db=# 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.
m_db=# SELECT * FROM test_grade WHERE score < 60;
id | name | score
----+------+-------
3 | Ben | 48
(1 row)
-- Drop.
m_db=# DROP TABLE test_grade;
Column aliases can be used in conditional queries.
Parent topic: SELECT
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