Compare each package with a target of eight items. This report needs the size of the difference, not whether the package is short or overfilled.
These tables are already loaded at the start of this lesson.
packingOne row represents one package record.
| Field / SQL type | Meaning | Rules |
|---|---|---|
pack_id · integer | Intended package identifier, used for ordering but not declared as a key. | Nullable; NULL means the identifier is unrecorded. |
label · text | Raw packing label, including its original spaces and letter case. | Nullable; NULL means no label value is recorded. |
items · integer | Whole-number count of items in the package, not its weight. | Nullable; NULL means the items is unrecorded, not zero. |
No primary key or nonnegative-item-count check is declared. The sample identifiers being distinct does not enforce uniqueness.
This table has no declared primary or unique key; distinct sample values are not a uniqueness guarantee.
Write your query in script.sql. Use Run to inspect it, then Submit.
Subtract the target first, then use ABS on the difference.