MySQL Questions and Answers – SQL Statement Syntax (Non-Compound Statements)

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
View Answer

Answer: a
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
View Answer

Answer: a
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?
a) BEGIN
b) CACHE INDEX
c) ALTER DATABASE
d) ALTER EVENT
View Answer

Answer: b
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.
advertisement
advertisement

4. Which statement can produce the same output as ‘SHOW COLUMNS’?
a) DESCRIBE
b) DISPLAY
c) SEE
d) GET
View Answer

Answer: a
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.
a) True
b) False
View Answer

Answer: a
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.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. The option that executes all SQL statements in a SQL script irrespective of the number of errors is _______________
a) –run
b) –ensure
c) –force
d) –violent
View Answer

Answer: c
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 _____________
a) WHERE
b) IS
c) SAME
d) LIKE
View Answer

Answer: d
Explanation: The ‘LIKE’ clause filters information that matches a given pattern. ‘WHERE’ clause selects information that is specified by a condition. ‘IS’ is used to match the exact condition specified.
advertisement

8. The header that should be included first is ________________
a) my_global.h
b) my_sys.h
c) mysql.h
d) my_local.h
View Answer

Answer: a
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.

9. What does mysql_init() return?
a) integer
b) float
c) structure
d) pointer to a structure
View Answer

Answer: d
Explanation: When NULL is passed to mysql_init() it automatically allocates an MYSQL structure, initializes it, and returns a pointer to it. The MYSQL data type is a structure containing information about a connection.
advertisement

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.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.