← DBMS & SQL learning pathDBMS & SQL · Module 5 of 10
Querying with SELECT
Read data with SELECT, filter with WHERE and sort with ORDER BY.
📖 Key ideas
- SELECT name, marks FROM students; picks columns.
- WHERE filters rows: WHERE marks > 60.
- ORDER BY marks DESC sorts; LIMIT 5 (or TOP / FETCH) restricts count.
- Operators: =, <>, >, BETWEEN, IN, LIKE 'A%', IS NULL.
- 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