tinyint

What is the difference between BIT and TINYINT in MySQL?

In which cases would you use which? Is there much of a difference? Which I typically used by persistence engines to store booleans? ...

Is there an advantage on setting tinyint fields when I know that the value will not exceed 255?

Should I choose the smallest datatype possible, or if I am storing the value 1 for example, it doesn't matter what is the col datatype and the value will occupy the same memory size? The question is also, cuz I will always have to convert it and play around in the application. UPDATE I think that varchar(1) and varchar(50) is the sa...

How do I convert a MySQL function result to tinyint(1)

Here's the problem. In MySQL's Connector/NET a TINYINT(1) field properly translates back and forth into a .NET bool value. If I select from a table with a TINYINT(1) column, everything is golden. However, when you use built-in MySQL v5.0 functions like: SELECT (3 BETWEEN 2 AND 4) AS oddly_not_boolean; The actual return type from the d...

Which is faster: char(1) or tinyint(1) ? Why?

Hi all, MY PLATFORM: PHP & mySQL MY SITUATION: I came across a situation where I need to store a value for user selection in one of my columns of a table. Now my options would be to: Either declare the Column as char(1) and store the value as 'y' or 'n' Or declare the Column as inyint(1) and store the value as 1 or 0 This column so...

Why can't tinyint store more than the number 255 in MySQL?

If TINYINT can store three characters, for example, why can't it store up to the number 999? ...

Html.RadioButton group defaulting to 0

Hi A default value of 0 is creeping into a Surveys app I am developing, for no reason that I can see. The problem is as follows: I have a group of Html.RadioButtons that represent the possible values a user can choose to answer a survey question (1 == Not at all, 2 == A little, 3 == A lot). I have used a tinyint datatype, that does n...

asp.net mvc linq sql problem

Hi all, I am working on a project using asp.net mvc 2 and linq to sql. The problem occurs when trying to insert data into a table where the table has an identity column type of tinyint. When trying to insert the following error occurs: The primary key column of type 'TinyInt' cannot be generated by the server. Does linq to sql suppor...

Use TinyInt to hide/show controls?

Hi, I have 6 buttons on my GUI. The visibility of the buttons can be configured via checkboxes. Checking the checkbox and saving means the correpsonding button should be shown. I am wondering if it is somehow possible to have one TinyInt column in the database which represents the visibility of all 6 buttons. I created an enum for the b...

Appropriate data field type for true/false value?

Hi everybody, What's the most appropriate (read least data consuming) data field to store a true/false/1/0 value in a mySQL database? I have previously used a one character long tinyint, but I am not sure if it's the best solution? Thanks! ...

SQL: Is it efficient to use tinyint instead of Integer if my max value is 255 ?

Lets assume I want to save the count of datagrid rows which can be max. 24 because each row is 1 hour. To save the row index in the database a tinyint field would be totally enough. But back in my mind I remember slightly that databases are optimized for integers?! So is it worth to use tinyint? ...

TINYINT vs ENUM(0, 1) for boolean values in MySQL

Which one is better, Tinyint with 0 and 1 values or ENUM 0,1 in MyISAM tables and MySQL 5.1? ...