This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Creating, Dropping, Indexing and Altering Tables”.
1. Which statement is used to remove indexes on tables?
a) DROP INDEX
b) DELETE INDEX
c) REMOVE INDEX
d) FLUSH INDEX
Explanation: MySQL provides statements to change the structure of tables. To add or remove the indexes on the existing database tables, the ‘CREATE INDEX’ and ‘DROP INDEX’ tables are used.
2. Which storage engine is not available in MySQL 5.0?
Explanation: All of the storage engines given are available in MySQL versions 5.0 and above, except ‘Falcon’. MySQL supports many storage engines or table handlers that have a specific set of properties.
3. The default storage engine used is ____________
Explanation: MySQL comes with multiple storage engines. The default storage engine used is ‘MyISAM’. ‘EXAMPLE’ is the stub storage engine, NDB is the storage engine for MySQL Cluster.
4. What is the name of the format file for a table named my_tbl?
Explanation: Every time a table is created in MySQL, it creates a disk file containing the format of the table. It has two components, namely, base name (here, ‘my_tbl’) and an extension (here, ‘frm’).
5. In the CREATE TABLE statement, the engine name specified is case sensitive.
Explanation: Suppose a table is created using the following statement: ‘CREATE TABLE my_tbl (…..) ENGINE = InnoDB;’. The engine name ‘InnoDB’ used is always case insensitive.
6. Which keyword is used to create a table as a temporary copy of itself?
Explanation: The ‘CREATE TABLE’ clause has a very vast formal format, although its usage is extremely simple and intuitive. One of the many ways is to create a table as a temporary copy of itself.
7. Which storage engine enables to access tables from a MySQL server managed by another server?
Explanation: There are many storage engines that are used in MySQL. By default, MyISAM is used as the storage engine unless specified otherwise. FEDERATED enables access to a foreign MySQL server.
8. It is possible to drop multiple tables in the same statement.
Explanation: To drop a table, all that is required is the table name. No additional information like table format or type is necessary. Multiple tables are dropped in the same DROP TABLE statement.
9. The default index type for MEMORY tables is __________
Explanation: The ‘HASH’ index is the default index type for ‘MEMORY’ tables. ‘SPATIAL’ can only be used with ‘MyISAM’ tables for the spatial data types. ‘FULLTEXT’ is used for performing full-text searches.
10. The statement to change the table name is __________
Explanation: To change the name of a table, the keyword ‘RENAME’ can be used. It can be used with the ‘ALTER TABLE’ clause. It can also be used as a statement in itself like ‘RENAME TABLE old_tbl new_tbl’.
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.