This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Case Sensitivity in SQL Statements”.
Explanation: The case sensitivity rules in SQL statements are different for different statement elements, depend on what is being referred to and also on the machine’s operating system on which the server is running.
2. What is true about the following SQL statement?
SELECT * FROM table_1;
b) display contents of table_1
c) improper case being used
d) display only column names in table_1
Explanation: The keywords and function names are not case sensitive in SQL. They can be named in any letter case. So, the above statement is correct and legal. It retrieves information from the table ‘table_1’.
a) SQL server
b) Server SQL mode
c) Operating system of machine
d) Does not depend on anything
Explanation: The default case sensitivity imposes a dependency on the operating system of the machine on which the MySQL server is running. Windows does not treat database and table names as case sensitive unlike Unix.
4. Which of the following is case sensitive?
a) Stored function name
b) Stored procedure name
c) Trigger name
d) Event name
Explanation: The stored functions and stored procedure names in MySQL are not case sensitive. Event names are also not case sensitive. Unlike the standard SQL, the trigger names in MySQL is case sensitive.
5. Which variable is used to set table alias names as non-case sensitive?
Explanation: In MySQL, by default the alias names are case sensitive. An alias can hence be specified in any letter case, upper, lower or mixed. If the variable ‘lower_case_table_names’ is non zero, the alias names of tables are not case sensitive.
6. Which case does InnoDB store database names in?
Explanation: In InnoDB, all the database names as well as all the table names are stored in lowercase internally. There is no random case assignment to the database elements when the engine is set as InnoDB.
must be referred to using the same lettercase throughout a given query.
Explanation: A database or table name must be referred to using the same lettercase throughout a given query. This is regardless of the fact whether it is case sensitive on the system or not.
8. Which of the following is case sensitive in MySQL?
a) Event names
b) Logfile group names
c) Column names
Explanation: Column names and indexes are not case sensitive on any platform and neither are column aliases. Unlike the standard SQL, the names of the log file groups are always case sensitive.
9. Which property determines whether a database object is case sensitive?
Explanation: The way to determine whether a database object or a database is case sensitive or not is to check the ‘COLLATION’ property. The result would be either CI for insensitive or CS for sensitive.
10. What is AI in terms of database collation?
a) Accent Insensitive
b) Augment Insensitive
c) Articulate Insensitive
d) Addition Insensitive
Explanation: The collation in database can also be specified in the join or comparison conditions. The value ‘AI’ means ‘Accent Insensitive’. ‘CS’ is case sensitive and ‘CI’ is case insensitive.
Sanfoundry Global Education & Learning Series – MySQL Database.
To practice all areas of MySQL Database, here is complete set of 1000+ Multiple Choice Questions and Answers.