Can DynamoDB have null values?

Yes. DynamoDB has a dedicated NULL type that represents an attribute with an unknown or undefined state. It also allows empty strings and empty binary values for non-key attributes, plus empty lists and maps. It does not allow empty sets (string, number, or binary), which are rejected with a ValidationException.

The NULL type

NULL is a real attribute type, written as {"NULL": true}. Use it when you want to record that a field exists but has no value — distinct from simply omitting the attribute.

What empties are allowed

  • Empty string / empty binary — allowed on non-key attributes, and inside lists and maps.
  • Empty list / empty map — allowed.

What is not allowed

  • Empty sets (SS, NS, BS) — rejected with a ValidationException.
  • Empty string or binary on a key attribute — key values must have length greater than zero.

Modeling tip

Omitting an attribute entirely is often cleaner than storing NULL, and it enables sparse indexes. Choose based on whether "absent" and "explicitly null" mean different things in your model.

Go deeper

Read DynamoDB data types and sparse indexes. Download DynoTable to edit attributes, including NULL, directly.

不必透過主控台就能操作 DynamoDB

DynoTable 是一款快速的 DynamoDB 桌面用戶端 — 瀏覽表格、執行 SQL 風格的查詢,並在本機編輯項目。