---
title: INT(11) is a lie
url: "https://aaronfrancis.com/videos/int11-is-a-lie"
path: "/videos/int11-is-a-lie"
type: video
author: Aaron Francis
published: 2023-10-04
topic: Databases
keywords: [int 11, integer columns, mysql, display width, database design, column types, planetscale, deprecated features]
youtube_url: "https://www.youtube.com/watch?v=xYl67AvQci8"
site_index: "/llms.txt"
keyword_index: "/llms/keywords.txt"
---

# INT(11) is a lie

## Chapters

- INT(11)
- The example table
- The underlying size of integer columns
- What the 11 is supposed to do
- What it's for, what it's not for

## Transcript

**Aaron Francis:** If you've been creating integer columns in MySQL like this, I'm about to blow your mind because this 11, it doesn't actually do anything. It can do something, but you have to add an extra keyword. The thing that it does is probably not the thing that you're thinking it does, and as of MySQL 8.0.17, it's deprecated.

**Aaron Francis:** So it's going away, so it's not gonna do anything at all in the future. We're gonna create an example table, and we're gonna take a look at a few examples. Good name. We'll start with a character column. So if we said email is a character column of varying length, how long do we want it to be? Let's say 255.

**Aaron Francis:** That seems excessive, but that's not the point of this video. So what we're saying here is that up to 255 characters can go in this column. That's reasonable enough. This is not interesting. We all know that. However, let's move on to a number column, and we'll say it's an integer of 11.

**Aaron Francis:** 11 what? 11 somethings. So what does this mean? Up to 11 digits? M- maybe. That seems reasonable enough, but it's 100% wrong. So what does this 11 actually mean? Right now, nothing. So if we were to create this table, and then we were to describe this table back, so describe example, we'll look and we'll see that the 11 is actually gone.

**Aaron Francis:** W- that information has just been lost. If we do show create table example, and we copy, we copy this out, that 11 is simply gone. It didn't matter. MySQL just threw it away because it's pointless. At least in our example, it's pointless, right? Because we created the table with it, and then we read it back, and MySQL said, "You don't need that part.

**Aaron Francis:** You don't need that part. I'm not even-- I didn't even remember what you told me. I just totally forgot." So unlike a character column, that 11 does not determine the underlying size of the column. If you wanna change the underlying size of the column, you would have to use one of the different data types. You could use the tinyint, which is a one-byte column, and the unsigned range is 0 to 255.

**Aaron Francis:** A smallint is two bytes, and that goes from 0 to 65,535. Which, interestingly enough, used to be the maximum number of rows that Microsoft Excel could support. So if you're ever at a party and you need a little tidbit, maybe try that one. That's a pretty good one. Moving up, you've got the mediumint, uh, the integer, and the bigint, and those maximum values just get truly enormous when you get up to the big integer column.

**Aaron Francis:** So what does the number in parentheses actually do, or what was it supposed to do? Because now it's deprecated, and it's going away forever, and so it doesn't really matter what it does. I can still tell you, it is only useful when you combine it with a zerofill keyword. So if we look at our table again, let's actually... Let's drop table example.

**Aaron Francis:** We'll get rid of that, and we're gonna say int 11 zerofill. And now if we run that, and we say show create table example, and we read this back, let's see if MySQL retained it. It looks like it did retain that int 11 and the zerofill.

**Aaron Francis:** It also forced it to be unsigned. So when you add the zerofill keyword, it forces it to be unsigned. Let's insert some data and see what this looks like. So insert into example. We'll put email and num, and we'll say values are Foo, and we'll just put 1 in there and see what happens.

**Aaron Francis:** We've got one row in there. Select star from example, and if we look at that, we see that number or num has been zero-padded. It's been filled with zeros until it reaches 11 characters long. That's what the 11 does. That's what the 11 does and will continue to do for who knows how long, but not very long because it is deprecated.

**Aaron Francis:** So I wouldn't even recommend using this whatsoever, but at least now you know what it's for and, more importantly, what it's not for. It is not for controlling the size of the column. If you wanna control the size of a numeric column, use one of the more appropriate data types. So if it's very small, tinyint, smallint. If it's huge, bigint.

**Aaron Francis:** But that int 11 only works if you add the zerofill keyword, and even then, I wouldn't recommend it. So hopefully this blew your mind. Hopefully, this has you questioning everything. If so, please leave a comment. We are currently accepting very nice, positive comments, subscriptions, and thumbs up. Um, if you would like to unsubscribe, leave a mean comment, or thumbs down, you'll have to wait for a future video.

**Aaron Francis:** Unfortunately, we're not accepting those at this moment. If you'd like to learn more about PlanetScale, you can go to planetscale.com. Until the next time, see ya.

---

## Related on aaronfrancis.com

- [Making videos developers actually want to watch](/podcast/making-videos-developers-actually-want-to-watch-6e3ad549) *(Podcast · 2024-06-03 · shared: mysql, planetscale, database design)*
- [MySQL for application developers](/about/speaking/mysql-for-application-developers) *(Talk · 2023-04-20 · shared: mysql, planetscale, database design)*
- [MySQL for Developers](/courses) *(Course · 2023-03-01 · shared: mysql, database design, planetscale)*
- [You don't always need JOINs](/videos/you-dont-always-need-joins) *(Video · 2023-11-22 · shared: mysql, planetscale, database design)*
- [Storing feature flags as JSON (with indexing)](/videos/storing-feature-flags-as-json-with-indexing) *(Video · 2023-11-14 · shared: mysql, database design, planetscale)*

## Relevant Resources from Aaron Francis

- **[MySQL for Developers](https://databaseschool.com)** (overview on site: [/courses](/courses)): Full video course covering MySQL indexing, deferred joins, pagination, query plans, and schema design for application developers.
- **[Mastering Postgres](https://databaseschool.com)** (overview on site: [/courses](/courses)): Deep-dive video course on PostgreSQL indexing, query performance, JSONB, full-text search, locking, and production operations.

## Search aaronfrancis.com (2-Hop Static Keyword Index)

Pick the alphabetical shard matching any topic to find exact pages across all articles, newsletters, videos, talks, and podcast transcripts (every shard is < 40 KB):
[A-B](/llms/keywords/a-b.txt) · [C](/llms/keywords/c.txt) · [D-E](/llms/keywords/d-e.txt) · [F-G](/llms/keywords/f-g.txt) · [H-J](/llms/keywords/h-j.txt) · [K-L](/llms/keywords/k-l.txt) · [M-N](/llms/keywords/m-n.txt) · [O-P](/llms/keywords/o-p.txt) · [Q-R](/llms/keywords/q-r.txt) · [S](/llms/keywords/s.txt) · [T-Z](/llms/keywords/t-z.txt) · [Directory](/llms/keywords.txt) · [Site Map](/llms.txt)

Shards for this page's topics: `int 11` ([H-J](/llms/keywords/h-j.txt)), `mysql` ([M-N](/llms/keywords/m-n.txt)), `display width` ([D-E](/llms/keywords/d-e.txt)), `column types` ([C](/llms/keywords/c.txt)).

## About Aaron Francis (Current Context)

Aaron Francis is VP of Marketing and Community at [Laravel](https://laravel.com), founder of [Try Hard Studios](https://tryhardstudios.com), creator of [Solo](https://soloterm.com), co-host of [Mostly Technical](/podcast), and author of [Mastering Postgres](/courses), [High Performance SQLite](/courses), [MySQL for Developers](/courses), and [Screencasting.com](/courses). Full bio: [/about](/about) · Current focus: [/now](/now).
