Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql equivalent data types

I'm coming from a SQL Server background. What would the equivalent data types be for the following in MySQL:

NVARCHAR - provides support for international, multi-byte characters for all languages

NVARCHAR(max) - allows for very long text documents

like image 915
Blankman Avatar asked Feb 06 '10 21:02

Blankman


People also ask

What are the 3 categories of MySQL data types?

In MySQL there are three main data types: string, numeric, and date and time.

What are the four data types in MySQL?

MySQL supports SQL data types in several categories: numeric types, date and time types, string (character and byte) types, spatial types, and the JSON data type.

Which below data types does MySQL support?

MySQL supports all standard SQL numeric data types which include INTEGER, SMALLINT, DECIMAL, and NUMERIC. It also supports the approximate numeric data types (FLOAT, REAL, and DOUBLE PRECISION). The keyword INT is a synonym for INTEGER, and the keywords DEC and FIXED are synonyms for DECIMAL.

What is the biggest data type in MySQL?

The largest character data type in MySql is LONGTEXT (see Storage Requirements for String Types), that is capable to hold 2^32-1 bytes.


1 Answers

Going by http://msdn.microsoft.com/en-us/library/ms186939.aspx, I would say that

VARCHAR(n) CHARSET ucs2 

is the closest equivalent. But I don't see many people using this, more often people use:

VARCHAR(n) CHARSET utf8 

As far as I am aware, both charactersets utf8 and ucs2 allow for the same characters, only the encoding is different. So either one should work, and I would probably go for the latter since it is used more often.

There are some limitations in MySQL's unicode support that may or may not apply to your use case. Please refer to http://dev.mysql.com/doc/refman/5.0/en/charset-unicode.html for more info on MySQL's unicode support.

like image 173
Roland Bouman Avatar answered Sep 30 '22 19:09

Roland Bouman