← DBMS & SQL learning path
DBMS & SQL · Module 5 of 10

Querying with SELECT

Read data with SELECT, filter with WHERE and sort with ORDER BY.

📖 Key ideas

  1. SELECT name, marks FROM students; picks columns.
  2. WHERE filters rows: WHERE marks > 60.
  3. ORDER BY marks DESC sorts; LIMIT 5 (or TOP / FETCH) restricts count.
  4. Operators: =, <>, >, BETWEEN, IN, LIKE 'A%', IS NULL.
  5. DISTINCT removes duplicate rows.
💡 Real-life example: SELECT is asking the librarian: "Show me all science books (WHERE), newest first (ORDER BY), only 5 (LIMIT)".
SELECTChooses columns to return
WHEREFilters rows
ORDER BYSorts results
LIKEPattern match on text