InfoparkDailyCAREER TOOLS

SQL · Lesson 2 of 8

SELECT & WHERE

Choosing columns and filtering rows with WHERE, AND, OR, IN, BETWEEN and LIKE.

List the columns you need instead of * — it's faster and clearer. Rename a column in the output with AS.

WHERE keeps only rows that match a condition:

  • Comparison: = <> < > <= >=
  • Combine: AND, OR, NOT (use brackets to be clear)
  • city IN ('Kochi', 'Kozhikode') — matches any value in a list
  • salary_lpa BETWEEN 5 AND 8 — inclusive range
  • title LIKE '%Developer%' — pattern: % any text, _ one character
  • company_id IS NULL — missing values (never = NULL)

Try it yourself

Press Run to see the results.

Runs on a small fictional sample database (companies, jobs) that is rebuilt on every run, so you can't break anything.

Key points

  • Select only the columns you need.
  • Text values go in single quotes.
  • Use IS NULL, not = NULL.

Quick check

Which pattern matches titles that start with 'Data'?

Practice task

List the title and salary of jobs whose title contains 'Developer' and pay between 5 and 8 LPA.

Interview corner

Why does WHERE column = NULL return nothing?

NULL means unknown, and any comparison with unknown is unknown (not true). Use IS NULL or IS NOT NULL.

What is the difference between WHERE and HAVING?

WHERE filters individual rows before grouping; HAVING filters groups after GROUP BY, so it can use aggregates like COUNT(*).

Further reading

Official documentation, linked for deeper study. These are outside sites; this lesson's text is our own.

Original lesson written by the InfoparkDaily team · © 2026 InfoparkDaily · Free to learn — no paid course or subscription.