Module 1 · Tables, types and the question you are actually asking

CASE, COALESCE and computing a column that does not exist

In this lesson

  • 7 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 8 of 12 in this chapter

This chapter’s goalSet up a working database on your own machine, read an unfamiliar schema well enough to say what one row of each table means and which columns join to which, and state the grain of any result you are about to compute before you compute it.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 7Free · no account needed
Lesson steps

SELECT can compute, not just retrieve

Every column in a SELECT list can be an expression. This is where a query stops fetching data and starts producing an answer.

SQL
SELECT
  full_name,
  amount,
  amount * 0.18                        AS tax,
  round(amount / 12.0, 2)              AS monthly,
  upper(left(full_name, 1))            AS initial,
  paid_on + interval '30 days'         AS due
FROM payments JOIN students ON ...

AS names the result. Without a name you get something like ?column?, which is unusable downstream.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Building Apps with AI exam.

Stuck on something?Ask Divya, your AI tutor

How to cite: Addaly (2026) ‘CASE, COALESCE and computing a column that does not exist’, in Data, SQL and Getting to the Answer. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/data-and-sql/case-expressions (Accessed: 29 November 2026).