This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “SQL Statement Syntax (Non-Compound Statements)”.
1. Which statement upgrades the database directory name encoding?
a) ALTER DATABASE
b) ALTER SERVER
c) ALTER EVENT
d) ALTER FUNCTION
Explanation: The statement ‘ALTER DATABASE’ changes database attributes or upgrades the database directory name encoding. It requires the ‘ALTER’ privilege for the database to be given.
2. The statement that alters an existing event to have the given definition is _____________
a) ALTER EVENT
b) ALTER DATABASE
c) ALTER FUNCTION
d) ALTER DATABASE
Explanation: The statement ‘ALTER EVENT’ alters an existing event to have the given definition. The ‘RENAME TO’ clause renames the event. The other clauses are described in the entry for ‘CREATE EVENT’.
3. What sets up an association between one or more MyISAM tables and the named key cache?
b) CACHE INDEX
c) ALTER DATABASE
d) ALTER EVENT
Explanation: ‘CACHE INDEX’ sets up an association between one or more MyISAM tables and the named key cache which must already exist. The INDEX privilege is needed for each table named in the statement.
4. Which statement can produce the same output as ‘SHOW COLUMNS’?
Explanation: The ‘DESCRIBE’ statement with a table name or view name produces the same kind of output as the ‘SHOW COLUMNS’ statement. The ‘SHOW’ entry can be referred to for further information.
5. Converting a client/server application to embedded server is difficult.
Explanation: Writing an application that uses the embedded server is different from writing one that operates in a client/server context. A program that is written as a client/server application can easily be converted to use the embedded server.
6. The option that executes all SQL statements in a SQL script irrespective of the number of errors is _______________
Explanation: If SQL queries in a file are run using mysql in batch mode, mysql either quits after the first error. If the –force option is specified all the queries are executed indiscriminately.
7. The clause that is used to display information that matches a given pattern is _____________
Explanation: The ‘LIKE’ clause filters information that match a given pattern. ‘WHERE’ clause selects information that is specified by a condition. ‘IS’ is used to match the exact condition specified.
8. The library file that contains various portability macros and definitions is ______________
Explanation: The ‘my_sys.h’ header file contains a variety of portability macros and definitions required for structures and functions. These structures and functions are used by the client library.
9. The header that should be included first is ________________
Explanation: The file ‘my_global.h’ takes care of including several other header files that are likely to be generally useful, like ‘stdio.h’. It also includes Windows compatibility information.
10. What does mysql_init() return?
d) pointer to a structure
Explanation: When NULL is passed to mysql_init() it automatically allocates a MYSQL structure, initializes it, and returns a pointer to it. The MYSQL data type is a structure containing information about a connection.
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.