midnightsyntax
midnightsyntax

Reputation: 419

What mysql INT for 0,1,2 or 3?

What should I use as mysql column type for a value that can either be 0, 1, 2 or , 3?

Upvotes: 1

Views: 488

Answers (2)

mu is too short
mu is too short

Reputation: 434665

If space isn't tight (and it rarely is these days), I'd just use int and move on to more interesting things. If space is tight, then a tinyint (one byte) would make sense. The numeric types with their ranges and storage requirements is here:

http://dev.mysql.com/doc/refman/5.6/en/numeric-types.html

An enum might be an option:

http://dev.mysql.com/doc/refman/5.6/en/enum.html

Upvotes: 2

Kai Qing
Kai Qing

Reputation: 18833

I would use tinyint(1)... and I have to type more cause SO requires at least 30 characters

Upvotes: 0

Related Questions