WebDevelopersNotes 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.

If it's on the Internet, it must be true.

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...]


Apple didn't invent the mouse. It was built at SRI International by Douglas Engelbart and patented in 1970. Apple licensed it for about $40,000. Also, Apple wasn't the first company to attach a mouse to a computer. This had been done by Xerox on their 8010 Star personal computer, which unfortunately wasn't a success probably because of its steep price, a staggering $16,000. In addition to being the inventor of modern mouse, Douglas Engelbart is best remembered for giving a live demonstration of several computer technologies at the Fall Joint Computer Conference in San Francisco. This Mother of All Demos took place on 9th December 1968 and showcased windows, hypertext, graphics, video conferencing, word processing and, of course, the mouse.Mother of All Demos video on YouTube [more...]

We use cookies to give you the best possible website experience. By using WebDevelopersNotes.com, you agree to our Privacy Policy