Field Manual PHP / Laravel reference
← SQL

WHERE

WHERE filters individual rows before grouping.

What it is

WHERE filters individual rows before grouping.

When to use it

Combine business conditions with explicit null handling.

Syntax

WHERE user_id = ? AND status IN (?, ?)

Example

SELECT id, total_cents FROM orders
WHERE user_id = 7
  AND status IN ('pending', 'paid')
  AND deleted_at IS NULL;

Common mistakes

Use IS NULL, not = NULL; parentheses matter when combining AND and OR.

Related topics

Browse SQL