liveBook · Manning

TINYINT

As explained in ScyllaDB in Action

TINYINT is a signed ScyllaDB integer type that stores small whole-number values.

TINYINT is ScyllaDB’s smallest signed integer type. It stores whole-number values from -128 through 127, making it suitable when a field’s known bounds fit within that range. section 4.2.2

For a restaurant-review application, a review score from 1 to 10 fits naturally in TINYINT. The articles table uses TINYINT for its score alongside TEXT, DATE, and other types. section 4.2.2 section 5.3.1

Use TINYINT when:

  • The value is a whole number rather than a decimal. section 4.2.2
  • The application can guarantee that values remain between -128 and 127. section 4.2.2
  • A compact integer is useful for a bounded field such as a review score or a date bucket. section 4.2.2 section 5.1.3

Review score in an articles table

Define the score column as `score TINYINT` in the articles table. A score such as 6 fits the type; attempting to insert 5000 produces a database error because the value is out of range. section 5.3.1 section 4.2.2

Table 4.4 The four integer types in CQL
Type
Size
Minimum value
Maximum value
TINYINT
8-bit
-128
127
SMALLINT
16-bit
-32,768
32,767
INT
32-bit
-2,147,483,648
2,147,483,647
BIGINT
64-bit
-9,223,372,036,854,775,808
9,223,372,036,854,775,807

Compare TINYINT’s size and bounds with SMALLINT, INT, and BIGINT before choosing a numeric type. section 4.2.2

How ScyllaDB in Action covers it

How deep it goes
Defines signed 8-bit bounds, demonstrates range validation, and stops short of deeper numeric implementation details.
Examples
Uses review scores, month buckets, successful integer insertion, and an out-of-range value of 5000.
What it assumes
Assumes basic fields and values, while introducing signed integers, numeric bounds, and type selection from application requirements.
What you can do after
Apply it via CQL by choosing TINYINT for fields whose known values fit its supported bounds.
How it connects
Connects integer type selection with data modeling, query-first design, date bucketing, and database error handling.

Also explained in

Compare how 3 books explain TINYINT →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ScyllaDB in Action. The section links point to the parts of the book it draws on.