Where Clauses & Operators in Drizzle ORM

From the Drizzle ORM cheat sheet · Select Queries · verified Jul 2026

Where Clauses & Operators

Filter queries with comparison and logical operators.

typescript
import { eq, ne, gt, gte, lt, lte, like, ilike,
  and, or, not, inArray, notInArray,
  between, isNull, isNotNull } from 'drizzle-orm';

// Equality
await db.select().from(users).where(eq(users.id, 1));

// Comparison
await db.select().from(users).where(gt(users.age, 18));

// Pattern matching (case-insensitive)
await db.select().from(users)
  .where(ilike(users.name, '%john%'));

// Logical AND / OR
await db.select().from(users).where(
  and(
    eq(users.isActive, true),
    or(
      gte(users.age, 18),
      eq(users.role, 'admin')
    )
  )
);
💡 ilike is PostgreSQL-only (case-insensitive)
⚡ All operators imported from 'drizzle-orm'
📌 and()/or() accept any number of conditions
🟢 Operators return SQL typed — fully composable
selectwhereoperatorsfilter

More Drizzle ORM tasks

Back to the full Drizzle ORM cheat sheet