Condition (SQL)


A relational database management system uses SQL conditions or expressions in WHERE clauses and in HAVING clauses to SELECT subsets of data.

Types of condition

To SELECT one row of data from a table called tab with a primary key column set to 100 — use the condition pk = 100:
SELECT * FROM tab WHERE pk = 100
To identify whether a table tab has rows of data with a duplicated column dk — use the condition having count > 1:
SELECT dk FROM tab GROUP BY dk HAVING count > 1