Q. Which statement is used to show the server’s current character set and collation settings?

  • (A) DISP VARIABLES
  • (B) SHOW CONSTRAINTS
  • (C) SHOW CONSTANTS
  • (D) SHOW VARIABLES
💬 Discuss
✅ Correct Answer: (D) SHOW VARIABLES
Explanation:

In MySQL, the SHOW VARIABLES statement is used to display the current system variables, including the character set and collation settings.

To check the current character set and collation for the server, you can run:

SHOW VARIABLES LIKE 'character_set%';
SHOW VARIABLES LIKE 'collation%';

This will return the character set and collation settings for various components like the server, client, connection, and database.

Why the other options are incorrect:

  • (A) DISP VARIABLES: This is not a valid MySQL command.
  • (B) SHOW CONSTRAINTS: This command is used to display constraints in the database, not character set or collation.
  • (C) SHOW CONSTANTS: There is no SHOW CONSTANTS command in MySQL. It’s not valid.

Therefore, the correct statement to show the server’s current character set and collation settings is (D) SHOW VARIABLES.

Explanation by: Praveen Singh

In MySQL, the SHOW VARIABLES statement is used to display the current system variables, including the character set and collation settings.

To check the current character set and collation for the server, you can run:

SHOW VARIABLES LIKE 'character_set%';
SHOW VARIABLES LIKE 'collation%';

This will return the character set and collation settings for various components like the server, client, connection, and database.

Why the other options are incorrect:

  • (A) DISP VARIABLES: This is not a valid MySQL command.
  • (B) SHOW CONSTRAINTS: This command is used to display constraints in the database, not character set or collation.
  • (C) SHOW CONSTANTS: There is no SHOW CONSTANTS command in MySQL. It’s not valid.

Therefore, the correct statement to show the server’s current character set and collation settings is (D) SHOW VARIABLES.

💬 Discussion


📊 Question Analytics

👁️
241
Total Visits
📽️
4 y ago
Published
🎖️
Mr. Dubey
Publisher
📈
87%
Success Rate