Squares and Cubes Table

–click a constraint to copy it
ConstraintWhat it enforcesExample
PRIMARY KEYUniquely identifies each row; NOT NULL + UNIQUE automaticallyid SERIAL PRIMARY KEY
FOREIGN KEYValue must exist in the referenced table\u2019s columnuser_id INT REFERENCES users(id)
UNIQUENo duplicate values in the column (NULLs allowed in PostgreSQL)email VARCHAR(255) UNIQUE
CHECKBoolean expression must be true for every rowprice DECIMAL CHECK (price >= 0)
NOT NULLColumn must have a value (no NULL)name TEXT NOT NULL
DEFAULTValue used when none is providedcreated_at TIMESTAMPTZ DEFAULT now()
EXCLUDERows must not conflict using the specified operatorEXCLUDE USING gist (room WITH =, during WITH &&)
Constraint semantics per the PostgreSQL manual's constraints chapter: NOT NULL, UNIQUE, PRIMARY KEY (unique plus not-null plus the index), CHECK (a row-level boolean), and FOREIGN KEY with its ON DELETE behavior. Constraints are checked on every write, which makes them the only data-integrity tool that cannot be forgotten by the next contributor. PostgreSQL constraints chapter.
Constraints follow the PostgreSQL constraints documentation. The two that catch everyone: UNIQUE allows multiple NULLs in PostgreSQL (NULL is not equal to NULL), and CHECK constraints are not inherited by the table when using LIKE for schema copying. Bottom line: constraints are the cheapest data quality tool - they run on every INSERT and UPDATE, require zero application code, and catch bugs that would otherwise corrupt your data silently. A NOT NULL on a name column has saved more data integrity than any ORM validation. SQL neighbours: SQL data types table, SQL joins table, regex cheatsheet, HTTP methods table.

Squares and cubes are the multiplication facts school skips after 12 - yet they decide tile areas, box volumes and why a 10% raise then a 10% cut leaves you behind. This table runs the full 1-100 range as exact integers, and the calculator adds the roots to six decimals so you can see which numbers open back up cleanly.

Everything here is computed, not transcribed: the table cannot be wrong by a typo, and the tool handles any number the table does not.

How to use

  1. Type any number for its square, cube, square root and cube root at once; chips jump to 12, 25, 64 and 100.
  2. Scan the table column for patterns: squares end only in 0, 1, 4, 5, 6 or 9 - never 2, 3, 7 or 8.
  3. Use √ on a perfect square to sanity-check the table row: √144 = 12, round trip closed.

Frequently asked questions

What is the largest square in the table?

100² = 10,000 and 100³ = 1,000,000 - one million is the smallest cube with seven digits, which is why "six figures" of cube makes a millionaire joke work. The calculator extends past 100 for any n.

Which numbers have exact cube roots?

The perfect cubes: 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000 - ten of them below 1000. Everything else gets a decimal; the calculator shows six places so 2∛ style rounding is visible, not hidden.

Why do squares never end in 2, 3, 7 or 8?

The last digit of n² depends only on the last digit of n, and squaring 0-9 yields only 0, 1, 4, 5, 6, 9. It is the fastest mental check that a number cannot be a perfect square - 15,392 fails before any dividing starts.

How fast does cubing grow?

Fast: 2³ = 8 is 8 times 1, but 10³ = 1000 is 10 times 100. Doubling the side of a box multiplies its volume by 8 - the reason small animals lose heat fast and whales do not, and why the 64 chip above is not just a bigger 32.

Related tools