Which of the following statements are true? Databases don’t have a default character set or collation

Which of the following statements are true? Databases don’t have a default character set or collation.

Which of the following statements are true? Databases don’t have a default character set or collation.

A.
Databases don’t have a default character set or collation.

B.
Database have a default character set and a default collation.

C.
When creating a table within a database without specifying a character set and a collation, the default character set and collation from the database are being used.

D.
If a default character set and collation are defined for a database, settings for tables defined in that database will be ignored.



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Shahriyar Rzayev

Shahriyar Rzayev

Another one problem…
The correct answers are C and D…
But D is arguable…i checked it and i can say that the table settings/definitions are used instead of default database character set and collation, if these table settings/definitions is written explicitly.
Let’s see:

mysql> select @@global.character_set_database;
+———————————+
| @@global.character_set_database |
+———————————+
| latin1 |
+———————————+
1 row in set (0.00 sec)

My default database character set is latin1.

mysql> create table charset_test(id int) default charset utf8;
Query OK, 0 rows affected (0.17 sec)

and

mysql> show create table charset_test\G
*************************** 1. row ***************************
Table: charset_test
Create Table: CREATE TABLE `charset_test` (
`id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

It used UTF8 instead of latin1.
Thanks.