LearnThatStack Ace your next interview
MySQL · question
Question 5 of 42

What are the numeric data types in MySQL?

beginner
← All MySQL questions
Re-explain

MySQL has exact integer types, the exact fixed-point type DECIMAL, and the approximate floating-point types FLOAT and DOUBLE.

Integer types, with their signed ranges:

  • TINYINT: 1 byte, from -128 to 127
  • SMALLINT: 2 bytes, from -32,768 to 32,767
  • MEDIUMINT: 3 bytes, from -8,388,608 to 8,388,607
  • INT: 4 bytes, from -2,147,483,648 to 2,147,483,647
  • BIGINT: 8 bytes, from -2^63 to 2^63 - 1

UNSIGNED allows only nonnegative values, so an INT UNSIGNED column holds 0 to 4,294,967,295.

Decimal and floating-point types:

  • DECIMAL, also called NUMERIC, stores exact values, for financial data.
  • FLOAT uses 4 bytes for single precision, and DOUBLE uses 8 bytes for double precision, so DOUBLE is more precise. Both are approximate, so exact comparisons can fail.
CREATE TABLE products (
    id INT AUTO_INCREMENT PRIMARY KEY,
    price DECIMAL(10,2),
    weight FLOAT,
    quantity SMALLINT UNSIGNED
);
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

The diagram below the answer is the concept . Jump to it ↓

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

Saved in this browser - sign in to keep your review list.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Interview lens

Likely follow-ups, what you can say, and the weak answers to avoid.

Sign in free to open it Free account - the lens opens as soon as you're back.

Want a quick review of the fundamentals? See the MySQL cheatsheet.

← Back to all MySQL questions
Pro · $10/mo

37 of 42 MySQL answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime