Skip to content
CodeKruPro

Missing values in a required column

SQLEasy

The product requires an email for every customer. Return the id and name of every customer whose email is missing. Missing means either NULL or empty text (''); an empty string is not the same as NULL.

Rows can come back in any order. Column names do not matter; the values do.

Sample database: Shop: customers, orders, order items and payments

Four tables of an online shop. customers (id, name, email, city, created_at): the product requires an email, but in this data it may be NULL or empty; city is optional. orders (id, customer_id, total, status, created_at): status is PAID, PENDING or CANCELLED. order_items (id, order_id, product, qty, price): one row per order line, worth qty times price. payments (id, order_id, amount, status): status is SUCCESS or FAILED. Dates are text in the form YYYY-MM-DD. No foreign keys are enforced, so the data may hold mistakes.

customers
idnameemailcitycreated_at
1Asha Raoasha@mail.inPune2026-01-02
2Ravi Kumarravi@mail.inDelhi2026-01-05
3Meena Iyermeena@mail.inChennai2026-01-09
4John DsouzaNULLMumbai2026-02-01
5Fatima Sheikhravi@mail.inDelhi2026-02-14
6Karan Singhkaran@mail.inNULL2026-03-01
7Lata Menonlata@mail.inPune2026-03-20
8Nisha PaulKochi2026-04-02
orders
idcustomer_idtotalstatuscreated_at
100111500PAID2026-03-01
10022800PAID2026-03-02
100332200PAID2026-03-03
10049450PAID2026-03-04
10051300CANCELLED2026-03-05
100621250PAID2026-03-06
10073600PAID2026-03-07
10085999PENDING2026-03-08
10092800PAID2026-03-02
order_items
idorder_idproductqtyprice
11001Keyboard11000
21001Mouse2250
31002Headset1800
41003Monitor12000
51004Cable3150
61005Mouse1300
71006Keyboard11000
81006Mouse pad1150
91006Cable1100
101007Webcam1600
111009Headset1800
121012Charger1500
payments
idorder_idamountstatus
50110011500SUCCESS
5021002800SUCCESS
50310032200SUCCESS
5041004450SUCCESS
50510061250SUCCESS
50610061250SUCCESS
5071007600FAILED
5081009800SUCCESS
SQL (SQLite)

Run shows your rows. Submit compares them with the expected rows.

to answer and keep your progress. Reading is free for everyone.