Bit type


show more Bit type provides you with in-depth training on Developer. Taught by Bill Weinman as part of the MySQL Essential Training show less
please wait ...

Bit type

Support for a bit type began with MySQL version 5.03. Before that the bit type was simply mapped to tiny int and didn't work very well. Because of this legacy, it's gotten a bad reputation. But as of MySQL 5.6, it works just fine, and it can be useful. So we're going to start with the scratch database here. And we're just going to create a simple table. I'll start as always with the Drop Table If Exists.

And we'll create a table and we'll give it a ID column, and a couple of BIT columns. So I have here a three-bit column and a five-bit column, together three and five is eight, so these two columns are going to just take up eight bits. And they'll all be packed into one eight bit unit, into one eight bit byte. The Bit type is designed to conserve space as much as possible. You can define several columns of various bit lengths in a single table, and MySQL will pack these into as few units of storage as possible, usually on eight-bit boundaries.

So let's go ahead and ...

Bit type
Video duration: 2m 26s 4h 24m Beginner

Viewers:

Bit type provides you with in-depth training on Developer. Taught by Bill Weinman as part of the MySQL Essential Training

Subject:
Developer
Software:
MySQL
Author:
please wait ...