← PostgreSQL learning path
PostgreSQL · Module 3 of 10

Querying data

Select, filter, sort and paginate with SQL.

📖 Key ideas

  1. SELECT name, email FROM users WHERE active = true ORDER BY name LIMIT 10;
  2. Pattern match: ILIKE '%sharma%' (case-insensitive).
  3. IN, BETWEEN, IS NULL in WHERE.
  4. DISTINCT removes duplicates.
  5. OFFSET skips rows (use keyset pagination for big tables).
💡 Real-life example: SELECT is asking a librarian: which books (columns), from which shelf (table), matching what rule (WHERE).
SELECTReads data
WHEREFilters rows
ILIKECase-insensitive pattern match
LIMITCaps rows returned