ExamVeda
Login
Home
21
The line that is not used to turn on the event scheduler is . . . . . . . .
Discuss
Answer & Solution
Answer: Option A
Solution:
The correct answer is D: eventscheduler = ON.
Let's understand why and how to correctly turn on the MySQL event scheduler.

The event scheduler in MySQL is a special feature that allows you to schedule tasks (like running a stored procedure or an SQL statement) to happen automatically at specific times or intervals, similar to `cron` jobs in Linux.

To turn on the event scheduler, you need to set the `event_scheduler` system variable to `ON`.

Here's why the options are correct or incorrect:

Option D: eventscheduler = ON
This is the incorrect way because the system variable name in MySQL is `event_scheduler` (with an underscore), not `eventscheduler` (without an underscore). MySQL is strict about variable names. Therefore, this line will not turn on the event scheduler. This is the line that is not used for the purpose, making it the correct answer to the question.

Option A: event_scheduler = ON
This line is used in the MySQL configuration file (like `my.cnf` on Linux or `my.ini` on Windows) under the `[mysqld]` section. When MySQL starts, it reads this file, and if this line is present, the event scheduler will be turned `ON` automatically.

Option B: SET GLOBAL event_scheduler = ON;
This is a SQL command used to turn on the event scheduler globally for the current running MySQL server instance. The `GLOBAL` keyword means the setting applies to all current and future sessions. This change is active immediately but will be lost if the server restarts unless it's also set in the configuration file (Option A).

Option C: SET @@GLOBAL.event_scheduler = ON;
This is another SQL command that achieves the same result as Option B. `@@GLOBAL.variable_name` is an alternative syntax to refer to a global system variable. It also turns on the event scheduler globally for the current running instance.

In summary, Options A, B, and C are valid ways to enable the event scheduler, while Option D uses an incorrect variable name and thus does not work.
22
What will be the storage pattern for "float(4,2)" in Mysql?
Discuss
Answer & Solution
Answer: Option A
Solution:
In MySQL, the syntax "float(4,2)" indicates a floating-point number with a total of 4 digits, with 2 digits to the left of the decimal point and 2 digits to the right of the decimal point.
The first parameter (4) specifies the total number of digits in the number, and the second parameter (2) specifies the number of digits after the decimal point.
Therefore, the storage pattern for "float(4,2)" in MySQL is as described in Option A.
Option B, Total of six digits, is incorrect because "float(4,2)" specifies a total of four digits, not six.
Option C, Total of four digits, not distributed uniformly, is incorrect because the digits are distributed uniformly, with two digits on each side of the decimal point.
Option D, None of the mentioned, is incorrect because Option A accurately describes the storage pattern for "float(4,2)" in MySQL.
23
To how many of the following does the prepared-statement API apply to?
CREATE TABLE, DELETE, DO, INSERT
Discuss
Answer & Solution
Answer: Option B
Solution:
The prepared-statement API applies to INSERT and DELETE statements among the given options.
Prepared statements allow for precompilation of SQL statements, providing performance benefits by reducing parsing overhead, and they can be reused with different parameter values.
However, the prepared-statement API does not directly apply to CREATE TABLE or DO statements.
Therefore, it applies to two of the provided statements.
24
Which program reads the statement from a binary log?
Discuss
Answer & Solution
Answer: Option B
Solution:
The program that reads the statement from a binary log in MySQL is mysqlbinlog.
Binary logs in MySQL contain records of all changes to the database (such as INSERT, UPDATE, DELETE statements) in a binary format.
The mysqlbinlog utility allows users to read the contents of these binary logs, making it useful for tasks such as auditing, replication, and troubleshooting.
Option A, mysql_config, is incorrect because mysql_config is a utility used to provide information about MySQL compilation options.
Option C, mysqldump, is incorrect because mysqldump is used to create logical backups of MySQL databases, not to read binary logs.
Option D, mysqlimport, is incorrect because mysqlimport is used to import data into MySQL tables from external files, not to read binary logs.
25
The statement to change the table name is . . . . . . . .
Discuss
Answer & Solution
Answer: Option D
Solution:
In MySQL, the statement used to change the table name is RENAME.
This statement is followed by the current table name and the new desired table name.
It allows you to rename an existing table in the database.
Option A, CHANGE, is incorrect because it is used in ALTER TABLE statements to change the name or datatype of a column, not to rename the entire table.
Option B, CHANGENAME, and Option C, CHANGENM, are incorrect because there is no such statement as CHANGENAME or CHANGENM in MySQL for changing the table name.
26
FULLTEXT indexes can be created only for . . . . . . . .
Discuss
Answer & Solution
Answer: Option A
Solution:
In MySQL, FULLTEXT indexes can be created only for tables that use the MyISAM storage engine.
FULLTEXT indexes allow for efficient searching of text data, enabling full-text search capabilities in MySQL.
The InnoDB storage engine, represented by Option B, does not support FULLTEXT indexes natively in MySQL. However, in recent versions, InnoDB has introduced support for FULLTEXT indexes with some limitations.
Options C and D (MEMORY and TRANSITION) are incorrect because neither of these storage engines supports FULLTEXT indexes in MySQL.
27
What will be the output of the following SQL statement?
SELECT  * FROM person
WHERE person_id=1;
Discuss
Answer & Solution
Answer: Option A
Solution:
The given SQL statement is a SELECT query that retrieves data from the "person" table where the "person_id" column equals 1. The WHERE clause filters the rows to only those where person_id=1. Therefore, the query will return all columns, but only the rows where person_id=1. Hence, Option A is correct.
28
The statement used to select a default database is . . . . . . . .
Discuss
Answer & Solution
Answer: Option A
Solution:
The statement used to select a default database in MySQL is USE. This statement is followed by the name of the database that you want to set as the default. Option A is the correct answer.
29
Input can be validated in MySQL programs.
Discuss
Answer & Solution
Answer: Option A
Solution:
Input validation can indeed be performed in MySQL programs. This involves ensuring that the data entered into the database meets certain criteria or constraints, such as data type, length, format, or range. By implementing validation checks within MySQL programs, developers can enhance data integrity and security. Therefore, Option A is correct.
30
Keyword "ASC" and "DESC" cannot be used without which clause in Mysql?
Discuss
Answer & Solution
Answer: Option A
Solution:
In MySQL, the keywords "ASC" (ascending) and "DESC" (descending) are used in conjunction with the "ORDER BY" clause to specify the sorting order of the query results. The "ORDER BY" clause arranges the rows returned by a query based on the values of one or more columns. Therefore, the keywords "ASC" and "DESC" cannot be used without the "ORDER BY" clause. Hence, Option A is correct.