This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Using Multiple-Statement Execution”.
1. Multiple statement execution is enabled by default.
a) True
b) False
View Answer
Explanation: The ‘multiple-statement’ execution is not enabled by default, so the server must be told that it is intended to be used. There are two ways to tell the server to enable the execution.
2. Which option enables multiple-statement execution?
a) CLIENT_MULTI_STATEMENTS
b) CLIENT_STATEMENTS_MULTI
c) MULTI_STATEMENTS_CLIENT
d) MULTI_CLIENTS_STATEMENTS
View Answer
Explanation: There are two ways to enable the multiple-statement execution. The first is to add the ‘CLIENT_MULTI_STATEMENTS’ option in the flags argument to ‘mysql_real_connect()’ at connect time.
3. Which of these is preferred when stored procedures are not being used?
CLIENT_MULTI_STATEMENTS, mysql_set_server_option()
a) CLIENT_MULTI_STATEMENTS
b) mysql_set_server_option()
c) any of the two
d) neither of the two
View Answer
Explanation: If the program does not use stored procedures anyone is suitable. If the program uses stored procedures and invokes a ‘CALL’ statement that returns a result set, the first method is better.
4. mysql_next_result() returns a status.
a) True
b) False
View Answer
Explanation: The function ‘mysql_next_result()’ returns a status and initiates retrieval of the next set if more results are available. The status is zero if more results are available and -1 if not.
5. Which option executes all SQL statements in a SQL script irrespective of the number of errors?
a) –ensure
b) –force
c) –violent
d) –run
View Answer
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.
6. The number of attributes in the following SQL table is ______________
CREATE TABLE employee ( emp_name CHAR(30), emp_id INT );
a) 1
b) 2
c) 3
d) 30
View Answer
Explanation: The name of the table created is ’employee’. It has two attributes, namely, ’emp_name’ and ’emp_id’. The attributes are the columns in a table. emp_name is of type string and emp_id is of type integer.
7. To see the table structure which command is issued?
a) VIEW tbl_name;
b) SELECT TABLE tbl_name;
c) SELECT tbl_name;
d) DESCRIBE tbl_name;
View Answer
Explanation: The ‘DESCRIBE’ command is issued to see the structure of the table ‘tbl_name’. It shows the structure in the format: Field-Type-Null-Key-Default-Extra. The ‘VIEW’ and ‘SELECT’ commands are used to see the contents of the table.
8. Which character is illegal in naming an unquoted identifier in SQL?
a) .
b) _
c) $
d) 2
View Answer
Explanation: An identifier is used to refer to a database or its elements. These elements can be entire tables or attributes. The names of these identifiers follow some set of rules, so they have a set of legal characters.
9. Which statement is valid if ‘`sampledb`’ is a database and ‘`tbl`’ is a table in it?
a) SELECT * FROM `sampledb.member`
b) SELECT * FROM `sampledb`.`member`
c) SELECT * FROM `member`.`sampledb`
d) SELECT * FROM `member.sampledb`
View Answer
Explanation: When quotes is being used to refer to a qualified name, the individual identifiers are quoted within the name separately. So, the database name `sampledb` and table name `tbl` are quoted separately.
10. The default case sensitivity of the database and table names depends on ___________
a) Server SQL mode
b) Operating system of machine
c) Does not depend on anything
d) SQL server
View Answer
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.
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.
- Practice Programming MCQs
- Check Information Technology Books
- Apply for Programming Internship
- Check MySQL Books