Oracle Database MySQL 5.6 Developer — Question 31
You have a database dev that contains 15 tables, all of which use the CHARACTER SET utfs and the COLLATION utfs_general_ci.
You perform the command:
ALTER DATABASE dev CHARACTER SET =latin COLLATION=latin1_swedish_ci
What is the result?
Answer options
- A. You get an error because database are not allowed to have CHARACTER SET or COLLATION attributes.
- B. You get an error because the settings for CHARACTER SET and COLLATION attributes do not match the settings for the tables inside the database.
- C. You get an error while trying to change from a more inclusive CHARACTER SET like ‘utfs to a less’ inclusive CHARACTER SET like ‘latin’.
- D. You get an error because changes to the CHARACTER SET or COLLATION attribute can happen only for empty databases.
- E. The statement succeeds and new tables created in this database use the new settings as their default values.
- F. The statement succeeds and all of the tables inside the database are converted to user the new settings.
Correct answer: E
Explanation
The correct answer is E because the ALTER DATABASE command will set the default CHARACTER SET and COLLATION for new tables created in the database, without affecting existing tables. The other options are incorrect as they misinterpret the behavior of the ALTER DATABASE command regarding existing tables and the conditions under which it can be executed.