I've created this MYSQL Syntax

CREATE TABLE  participants (

user_id MEDIUMINT UNSIGNED NOT NULL 
 AUTO_INCREMENT,
 email VARCHAR(50) NOT NULL,
 state VARCHAR(20) NOT NULL,
 district VARCHAR(50) NOT NULL,
 gender VARCHAR(6) NOT NULL,
 age VARCHAR(2) NOT NULL,
 profession VARCHAR(70) NOT NULL,
 survey BOOLEAN,
 registration_date DATETIME NOT NULL,
PRIMARY KEY (user_id)
);

I typed into the myphp admin SQL query box. The system accepted the code and created the table but why instead of BOOLEAN It showed survey "tinyint(1)"

why it did that and what is the difference between BOOLEAN and tinyint(1). Which is recommended for a checkbox input (html)

    I personally still use BOOLEAN, in case some future version of MySQL makes a distinction between BOOLEAN and TINYINT(1).

      I use Boolean because I think it's more semantically correct.

        well i use TINYINT as its just a synonym, it must be a few nanoseconds faster than having mysql convert it; and it makes the code more user friendly.

          Thanks for the reply guys. I talked to my web hosting company 1and1.com. The current version of their database is MYSQL 5 and somehow the data type BOOLEAN is no longer supported. TINYINT(1) is the majority that users use. It's been a couple of years that I have not touched MYSQL and this is a huge surprise.

            cybereclipse;10999086 wrote:

            The current version of their database is MYSQL 5 and somehow the data type BOOLEAN is no longer supported.

            That's definitely false. Keywords 'BOOL' and 'BOOLEAN' were added in MySQL 4.1.0 and have been there ever since; here is a link to their mention in the MySQL docs for 5.6 (the latest ones published).

              BOOL is def there, TINYINT is def there but BOOLEAN is not showing up in the data type drop down list. I did saw BOOLEAN from the link that you provided so somehow I'm getting conflicts of information here. Anyways thanks for your help guys.

                MySQL has no "drop down list".

                Perhaps you're confusing MySQL with some front end application, such as phpMyAdmin?

                EDIT: Also note that BOOL and BOOLEAN are one and the same.

                  Opps, I thought I wrote phpmyadmin on my previous post, guess not. So def was referring to phpmyadmin

                    Write a Reply...