Interview Questions and Answers

MySQL Interview Questions and Answers

Spread the love

MySQL Interview Questions and Answers for Freshers –

Question 1. Is open source MySQL database?

Answer : Yes, MySQL is open source.

Question 2. What is default engine of MySQL Database?

Answer : MyISAM.

Question 3. How many types of engine or types of table used in MySQL Database?

Answer : There are five types of tables that are present – MyISAM, Merge, INNO DB, ISAM and Heap.

Question 4. How to delete a table in MySQL?

Answer : DROP TABLE table_name;

Question 5. How to change the database name in MySQL?

Answer : The following is the syntax of using mysqldump command:
mysqldump -u username -p “password” -R oldDbName > oldDbName.sql

Question 6. What is the default port number of MySQL Database?

Answer : The default port number of MySQL is 3306.

Question 7. What is the difference between mysql_fetch_array() and mysql_fetch_object() ?

Answer : Both mysql_fetch_array() and mysql_fetch_object() are built-in function of PHP to retrieve records from MySQL database table.
mysql_fetch_array() returns the result as an array and mysql_fetch_object() returns the result as an object.

Question 8. What is difference between delete and truncate in MySQL?

Answer : The DELETE command removes particular records from a table –
DELETE FROM table_name WHERE conditions;

TRUNCATE command is used to delete the complete data from the table without deleting the table structure.
TRUNCATE TABLE table_name;

Question 9. How many types of commands are in SQL?

Answer : There are five types of SQL commands in SQL –

  • Data Definition Language (DDL)
  • Data Manipulation Language (DML)
  • Data Control Language (DCL)
  • Transaction Control Language (TCL)
  • Data Query Language (DQL)

Question 10. How can you show the version of the installed MySQL?

Answer : You can get version of the installed MySQL Database from command prompt –
mysql> SHOW VARIABLES LIKE “%version%”;

Leave a Reply

Your email address will not be published. Required fields are marked *