ExamVeda
Login
Home
51
What is the statement used to select a default database?
Discuss
Answer & Solution
Answer: Option A
Solution:
USE: The USE statement in MySQL is used to select a default database for the current session. It allows you to switch to a different database, and subsequent queries will operate within that selected database until changed again.
CREATE: The CREATE statement in MySQL is used to create new database objects such as tables, indexes, views, etc. It is not used for selecting a default database.
DROP: The DROP statement in MySQL is used to delete database objects such as tables, indexes, views, etc. It is not used for selecting a default database.
SCHEMA: In MySQL, SCHEMA is a synonym for DATABASE. It is used to create, modify, or query database objects. However, it is not used specifically for selecting a default database.

Therefore, the statement used to select a default database in MySQL is Option A: USE.
52
Multiple MySQL servers can be run on the same machine.
Discuss
Answer & Solution
Answer: Option B
Solution:
True: It is indeed possible to run multiple MySQL servers on the same machine. Each MySQL server instance can be configured to use different ports, data directories, and configuration files, allowing them to operate independently on the same physical or virtual machine.
False: This statement is incorrect. Running multiple MySQL servers on the same machine is possible, as described above.
None of the mentioned: This option is not applicable as the correct statement is indeed true.

Therefore, the correct statement is Option A: True.
53
Mysql command line tool is used to show "how many rows are returned and how long SQL command took to execute".
Discuss
Answer & Solution
Answer: Option C
Solution:
True: The MySQL command-line tool provides functionality to display the number of rows returned by a query and the execution time of SQL commands. By default, after executing a query, the MySQL command-line tool displays the number of rows affected (for INSERT, UPDATE, DELETE statements) or the number of rows returned (for SELECT statements). Additionally, MySQL provides options like SHOW WARNINGS and SHOW STATUS to display various details including execution time.
False: This statement is incorrect. The MySQL command-line tool is indeed capable of showing the number of rows returned and the execution time of SQL commands.
Undetermined: There is no ambiguity regarding this statement. The MySQL command-line tool provides functionality to display these details.
Depend: This option is not applicable. The MySQL command-line tool consistently provides information about the number of rows returned and the execution time of SQL commands.

Therefore, the statement is Option A: True.
54
Find the missing clause from the following SQL statement?
CREATE VIEW person_1 AS
SELECT fname, lname, person_id
_________ person;
Discuss
Answer & Solution
Answer: Option A
Solution:
FROM: In SQL, the FROM clause is used to specify the table or tables from which data will be selected. In this context, the FROM clause is required to indicate the source table (person) from which the columns fname, lname, and person_id are selected.
WHERE: The WHERE clause is used to specify conditions that filter the rows returned by the query. It is not necessary in this context since the SELECT statement does not include any filtering conditions.
SELECT: The SELECT keyword is already present in the SQL statement, so it is not the missing clause.
None of the mentioned: This option is not applicable as there is indeed a missing clause that needs to be identified.

Therefore, the missing clause from the SQL statement is Option A: FROM.
55
AUTO_INCREMENT columns must be NOT NULL.
Discuss
Answer & Solution
Answer: Option A
Solution:
In MySQL, when defining a column with the AUTO_INCREMENT attribute, there are certain constraints and requirements that must be followed. We need to determine whether it is necessary for columns with AUTO_INCREMENT to also be NOT NULL.

The correct option is Option A: True.
56
Which of these take more space?
Variable length columns, Fixed length columns
Discuss
Answer & Solution
Answer: Option C
Solution:
Variable length: Variable-length columns store data in a flexible manner, allowing the storage of data of varying lengths. They only consume as much space as needed for the actual data stored. Examples include VARCHAR and TEXT data types. Variable-length columns typically take less space because they only use as much storage as necessary to accommodate the data.
Fixed length: Fixed-length columns allocate a fixed amount of storage space for each row, regardless of the actual length of the data stored. Examples include CHAR and BINARY data types. Fixed-length columns consume the same amount of space for each row, even if the data stored in them is shorter than the allocated space. Therefore, fixed-length columns generally take more space compared to variable-length columns, especially if the actual data lengths vary widely.
Same: This option is incorrect. Fixed-length columns typically take more space compared to variable-length columns due to the allocation of a fixed amount of storage space for each row.
Indeterminate: This option implies uncertainty or unpredictability, but in this context, it is clear that fixed-length columns generally take more space than variable-length columns.

Therefore, the correct answer is Option C: fixed length, as fixed-length columns typically take more space compared to variable-length columns.
57
The server listens on a network port for TCP/IP connections unless started with the option . . . . . . . .
Discuss
Answer & Solution
Answer: Option B
Solution:
-skip-networking: This option is used to instruct the MySQL server not to listen for TCP/IP network connections. When this option is specified during server startup, the MySQL server does not open the network port for incoming connections, effectively preventing remote clients from connecting via TCP/IP. This option is typically used in scenarios where local access to the MySQL server is sufficient, and there's no need for remote connections.
-networking: This option is not correct. There is no option named -networking in MySQL that controls whether the server listens on a network port for TCP/IP connections.
-skip-networks: This option is not correct. The correct option to skip networking is -skip-networking, not -skip-networks.
-quit-networking: This option is not correct. There is no option named -quit-networking in MySQL that controls networking behavior.

Therefore, the option used to prevent the MySQL server from listening on a network port for TCP/IP connections is Option B: -skip-networking.
58
Stored routines refers to stored functions and procedures.
Discuss
Answer & Solution
Answer: Option A
Solution:
True: Stored routines in MySQL include both stored functions and stored procedures. Stored functions are routines that return a single value and can be used in SQL statements like built-in functions. Stored procedures are routines that perform one or more SQL statements and can have input and output parameters. Both stored functions and stored procedures are stored in the database and can be invoked by client applications or other database objects.
False: This statement is incorrect. Stored routines in MySQL do indeed refer to both stored functions and stored procedures.
None of the mentioned: This option is not applicable. The correct statement is that stored routines encompass both stored functions and stored procedures.

Therefore, the correct statement is Option A: True.
59
The maximum length of the varchar columns is . . . . . . . .
Discuss
Answer & Solution
Answer: Option A
Solution:
In MySQL, the VARCHAR data type is used to store variable-length character strings. We need to determine the maximum length allowed for VARCHAR columns.

The correct option is Option A: Upto 65,535 bytes.

Upto 65,535 bytes: In MySQL, the maximum length of VARCHAR columns is 65,535 bytes. This limit applies to the maximum size of the column in terms of bytes, not characters. The actual number of characters that can be stored may be less depending on the character set and encoding used. For example, if the UTF-8 character set is used, some characters may require more than one byte to store, reducing the maximum number of characters that can be stored in the VARCHAR column.
Upto 256 bytes: This option is incorrect. While VARCHAR columns have a maximum length, it is much larger than 256 bytes.
Upto 65,567 bytes: This option is incorrect. The maximum length of VARCHAR columns is not 65,567 bytes. The correct limit is 65,535 bytes.
None of the mentioned: This option is not correct. The maximum length of VARCHAR columns in MySQL is specified and can be determined.

Therefore, the maximum length of VARCHAR columns in MySQL is Option A: Upto 65,535 bytes.
60
The keyword used with UNION that does not retain duplicate rows is . . . . . . . .
Discuss
Answer & Solution
Answer: Option D
Solution:
DISTINCT: When used with UNION, the DISTINCT keyword ensures that duplicate rows are eliminated from the combined result set. It retains only unique rows across all the result sets being combined using UNION. Therefore, if there are any duplicate rows in the result sets, they will be removed, and only distinct rows will be included in the final result set.
ALL: The ALL keyword, when used with UNION, retains all rows from the combined result sets, including duplicates. It is the default behavior of UNION if no keyword is specified. This option is incorrect because it retains duplicate rows, contrary to the requirement.
NARROW: This option is incorrect. There is no keyword named NARROW associated with UNION in MySQL.
STRICT: This option is incorrect. The STRICT keyword is not used with UNION in MySQL.

Therefore, the keyword used with UNION that eliminates duplicate rows is Option D: DISTINCT.