MySQL Questions and Answers – Creating, Dropping, Indexing and Altering Tables

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

Answer: a
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?
a) InnoDB
b) ARCHIVE
c) Falcon
d) NDB
View Answer

Answer: c
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 ____________
a) EXAMPLE
b) ARCHIVE
c) MyISAM
d) NDB
View Answer

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

4. What is the name of the format file for a table named my_tbl?
a) my_tbl.fmt
b) my_tbl.frm
c) my_tbl.fmr
d) my_tbl.ftm
View Answer

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

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

6. Which keyword is used to create a table as a temporary copy of itself?
a) TEMP
b) TEMPO
c) TEMPR
d) TEMPORARY
View Answer

Answer: d
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?
a) InnoDB
b) EXAMPLE
c) MyISAM
d) FEDERATED
View Answer

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

8. It is possible to drop multiple tables in the same statement.
a) True
b) False
View Answer

Answer: a
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 __________
a) HASH
b) SPATIAL
c) FULLTEXT
d) UNIQUE
View Answer

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

10. The statement to change the table name is __________
a) CHANGE
b) CHANGENAME
c) CHANGENM
d) RENAME
View Answer

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

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

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.