liveBook · Manning

TINYINT

As explained in Grokking Relational Database Design

TINYINT is a small SQL integer data type with an implementation-defined fixed storage size and numeric range.

TINYINT is a small SQL integer type that uses one byte of storage. Its numeric range depends on whether it is signed or unsigned: signed TINYINT reaches 127, while unsigned TINYINT reaches 255. section 4.6

Use these rules when choosing an integer type:

  • Compare the attribute’s required values with the available signed or unsigned range. section 4.6
  • Prefer a larger integer type when the attribute can exceed TINYINT’s limits. section 4.6
  • Remember that unsigned numbers cannot be negative, while signed numbers can. section 4.6

Choosing a type for payment_id

A payment_id is a numeric identifier, but TINYINT is too small for a growing online store. INT is considered large enough for now, while BIGINT supports an even larger future scale. section 4.6

How Grokking Relational Database Design covers it

How deep it goes
Defines one-byte storage and signed or unsigned limits, then applies them to a payment identifier.
Examples
Uses payment_id and a galaxy-scale online store to compare TINYINT, INT, and BIGINT.
What you can do after
Evaluate required values and choose an integer type using signed or unsigned ranges.
How it connects
Connects TINYINT with integer data types, signed numbers, unsigned numbers, and numeric IDs.

Also explained in

Compare how 3 books explain TINYINT →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Relational Database Design. The section links point to the parts of the book it draws on.