Condition (SQL) explained

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

Types of condition

Examples

To one row of data from a table called tab with a primary key column (pk) 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

Notes and References

  1. Book: Fehily , Chris . SQL: Visual Quickstart Guide. 2. 2005. Peachpit Press. 978-0-321-33417-6. 439–440, 480. SQL Keywords [...] The appendix lists the standard's reserved and non-reserved keywords. [...] EXISTS [...].
  2. Book: Fehily , Chris . SQL: Visual Quickstart Guide. 2. 2005. Peachpit Press. 978-0-321-33417-6. 278. EXISTS and NOT EXISTS [...] look for the existence or nonexistence of rows in a subquery result..