Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

create table check2(f1 varchar(20),f2 varchar(20));

creates a table with the default collation latin1_general_ci;

alter table check2 collate latin1_general_cs;

show full columns from check2;

shows the individual collation of the columns as 'latin1_general_ci'.

Then what is the effect of the alter table command?

1 Answer

0 votes
by (40.7k points)
edited by

If you want to change the default character set and collation of a table including those of existing columns (note the convert to clause) then use the below code:

alter table <some_table> convert to character set utf8mb4 collate utf8mb4_unicode_ci;

For more information, you can refer to https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-utf8.html

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 19, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
asked Jul 24, 2019 in SQL by Tech4ever (20.3k points)

Browse Categories

...