This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Functions”.
1. The server is told to accept spaces after function names by _____________
Explanation: The MySQL server is told to accept spaces after function names by starting it with the ‘–sql-mode=IGNORE_SPACE’ option. Individual client programs can request this behavior by using the ‘CLIENT_IGNORE_SPACE’ option for ‘mysql_real_connect()’.
2. Which function returns NULL if expr1 = expr2?
Explanation: The ‘CASE’ is used for the case operator. The function ‘IF()’ is used for the if/else construct. The function ‘IFNULL()’ is the Null if/else construct. ‘NULLIF()’ returns NULL if expr1 = expr2.
3. The operator that compares sounds is _____________
a) MATCH SOUNDS
b) CHECK SOUNDS
c) SOUNDS LIKE
d) SOUNDS SIMILAR
Explanation: The operator ‘SOUNDS LIKE’ is used to compare sound. The ‘RLIKE’ is a synonym for ‘REGEXP’, which is a pattern matching using regular expressions. There are a lot of other operators for use.
4. The string function that returns the index of the first occurrence of substring is _____________
Explanation: The string function ‘INSTR()’ is used to return the index of the first occurrence of the substring. The function ‘INSERT()’ is used to insert a substring at the specified position up to the specified number of characters.
5. CGI.pm does not support an object oriented style of use.
Explanation: ‘CGI.pm’ supports an object oriented style of use which allows to invoke its functions without importing the names. To do this, a use statement is included and a CGI object is created.
6. There cannot be more than one column per table with the AUTO_INCREMENT attribute.
Explanation: In MySQL, there can only be one column per table with the AUTO_INCREMENT attribute. It should also have an integer data type. The AUTO_INCREMENT is also allowed for floating point types.
7. What does the AUTO_INCREMENT sequences begin at by default?
Explanation: The AUTO_INCREMENT column attribute provides unique numbers for column identification. AUTO_INCREMENT sequences normally begin at 1 and increase monotonically like 1, 2, 3, and so on.
8. The one that is not optional is _____________
SELECT select_list FROM table_list WHERE row_constraint GROUP BY grouping_columns;
Explanation: Given above was a basic syntax of the SELECT statement. Everything in the syntax is optional except the ‘select_list’ option. All the others are free to be omitted, and will work fine.
9. The join in which all the rows from the right table appear in the output irrespective of the content of the other table is ______________
a) CARTESIAN JOIN
b) CROSS JOIN
c) INNER JOIN
d) RIGHT JOIN
Explanation: In a ‘RIGHT JOIN’, the output is produced for every row of the right table, even if it does not exist in the other table. This is the reason why it is called a ‘RIGHT JOIN’. ‘RIGHT JOIN’ and ‘LEFT JOIN’ are a kind of OUTER JOIN.
10. The facility that allows nesting one select statement into another is ______________
Explanation: The ‘subquerying’ support provided by MySQL is a capability that allows writing one ‘SELECT’ statement within parentheses and nesting within another. This allows logically selecting content from tables.
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.