WDN Logo

home-icon Home / MySQL / MySQL online tutorial – Column Types part 2

MySQL online tutorial – Column Types part 2

MySQL online tutorial - Column Types part 2

MySQL Text data type

Text can be fixed length (char) or variable length strings. Also, text comparisons can be case sensitive or insensitive depending on the type you choose.

  • CHAR(x): where x can range from 1 to 255.
  • VARCHAR(x): x ranges from 1 – 255
  • TINYTEXT: small text, case insensitive
  • TEXT: slightly longer text, case insensitive
  • MEDIUMTEXT: medium size text, case insensitive
  • LONGTEXT: really long text, case insensitive
  • TINYBLOB: Blob means a Binary Large OBject. You should use blobs for case sensitive searches.
  • BLOB: slightly larger blob, case sensitive.
  • MEDIUMBLOB: medium sized blobs, case sensitive.
  • LONGBLOB: really huge blobs, case sensitive.
  • ENUM: Enumeration data type have fixed values and the column can take only one value from the given set. The values are placed in parenthesis following ENUM declaration. An example, is the marital status column we encountered in employee_per table.
    m_status ENUM("Y", "N")

    Thus, m_status column will take only Y or N as values. If you specify any other value with the INSERT statement, MYSQL will not return an error, it just inserts a NULLvalue in the column.

  • SET: An extension of ENUM. Values are fixed and placed after the SET declaration; however, SET columns can take multiple values from the values provided. Consider a column with the SET data type as
    hobbies SET ("Reading", "Surfing", "Trekking", "Computing")

    You can have 0 or all the four values in the column.

    INSERT tablename (hobbies) values ("Surfing", "Computing");

Sponsored Links


Your comments
Star icon IMPORTANT Have a question / problem? Click here to ask an expert.

Etch-A-Sketch iPad case

Sponsored Links


How do I view a deleted web page?
Is there a way to view a deleted web page - one that is no longer available? Yes there is and the solution is quite simple. [more...]


The story behind the origin of the name of Linux is interesting. The creator of the operating system, Linus Torvalds, had originally named it "Freax" - a combination of "free", "freak" and "x". He had also considered "Linux" but thought it was too egoistical. So, during development, Torvalds had stored all files in a directory named Freax. Anyway, the files and the directory (with the name Freax) were maintained on an FTP server of FUNET. Ari Lemmke, who was one of the the administrators of the server, didn't like the name 'Freax' and changed it to 'Linux' without asking Torvalds, who later agreed to keep the new name.The first version of Linux was released on 25th August 1991. By the way, Ari Lemmke had played a role in the early days of the World Wide Web. He had been the the supervisor of the four Finnish students who developed Erwise, the first graphical web browser, at the Helsinki University of Technology. FYI, the term 'Linux' is trademarked in the US by Linus Torvalds to prevent others from making money off it. [more...]

Share on Whats app Share on Facebook Share on Twitter Share on Google plus