MySQL Error #1071 – Specified key was too long; max key length is 767 bytes

When I executed the following command: ALTER TABLE `mytable` ADD UNIQUE ( `column1` , `column2` ); I got this error message: #1071 – Specified key was too long; max key length is 767 bytes Information about column1 and column2: column1 varchar(20) utf8_general_ci column2 varchar(500) utf8_general_ci I think varchar(20) only requires 21 bytes while varchar(500) only … Read more

What is the difference between char, nchar, varchar, and nvarchar in SQL Server?

What is meant by nvarchar? What is the difference between char, nchar, varchar, and nvarchar in SQL Server? 12 s 12 Just to clear up… or sum up… nchar and nvarchar can store Unicode characters. char and varchar cannot store Unicode characters. char and nchar are fixed-length which will reserve storage space for number of … Read more

Difference between text and varchar (character varying)

What’s the difference between the text data type and the character varying (varchar) data types? According to the documentation If character varying is used without length specifier, the type accepts strings of any size. The latter is a PostgreSQL extension. and In addition, PostgreSQL provides the text type, which stores strings of any length. Although … Read more

What is the difference between varchar and nvarchar?

Is it just that nvarchar supports multibyte characters? If that is the case, is there really any point, other than storage concerns, to using varchars? 20 20 An nvarchar column can store any Unicode data. A varchar column is restricted to an 8-bit codepage. Some people think that varchar should be used because it takes … Read more