COUNT with a WHERE filter using IS NULL
Weekly scorecard for the ops call — how many accounts are currently open? `banking_accounts` has a `close_date` that's NULL for any account still on the books. Single number, call the column `open_accounts`.
| Column | Type | Key |
|---|---|---|
| account_id | INT | PK |
| customer_id | INT | FK → banking_customers |
| product_type | TEXT | |
| open_date | TEXT | |
| close_date | TEXT | |
| credit_limit | REAL | |
| current_fico | INT | |
| status | TEXT |
Each hint you reveal reduces the XP you can earn. Try the query first.
Accounts still on the books have a specific data pattern in the close column. How does SQL test for the absence of a value — and why can't you use = for this?
Count rows from banking_accounts where close_date is absent — alias the column open_accounts so the scorecard cell binds correctly.
You could also check `status = 'Open'` — in this seed the two are consistent, but `close_date IS NULL` is the more defensive query because it doesn't depend on status being kept up to date.