Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can mysql charset for table and column be different?

Does it makes sense to have two different charset for table and a single column in the same table ? or will it create problem, especially for the below mentioned example ?

For example,

Table charset - latin1
Column C1 charset - utf8mb4
like image 628
chandramohan Avatar asked Mar 09 '23 11:03

chandramohan


1 Answers

Tables don't have a charset anyway, the only thing they have is a default charset. The only thing that has an actual "physical" charset are columns, because they're the only thing that actually stores data. The way it works is that if you're not setting an explicit charset for a column, the table's default is used. And if the table doesn't have a default, the database's default is used. And if that doesn't have a default, the server's default is used.

like image 83
deceze Avatar answered Mar 19 '23 16:03

deceze