0% found this document useful (0 votes)
406 views

MySQL Interview Questions and Answers For Experienced and Freshers

The document provides a collection of MySQL interview questions and answers. It begins by comparing MySQL and SQL Server, then provides answers explaining what the MySQL server is, its default port, why SQL Server is popular, MySQL features, and SQL statements like DDL, DCL, and DML. Further answers cover JOIN types, data types like CHAR and VARCHAR, functions, table concatenation, version checking, indexing limits, and backups. It concludes by differentiating DELETE and TRUNCATE, storage models, and encouraging preparation.

Uploaded by

Mohmad Ashik M A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
406 views

MySQL Interview Questions and Answers For Experienced and Freshers

The document provides a collection of MySQL interview questions and answers. It begins by comparing MySQL and SQL Server, then provides answers explaining what the MySQL server is, its default port, why SQL Server is popular, MySQL features, and SQL statements like DDL, DCL, and DML. Further answers cover JOIN types, data types like CHAR and VARCHAR, functions, table concatenation, version checking, indexing limits, and backups. It concludes by differentiating DELETE and TRUNCATE, storage models, and encouraging preparation.

Uploaded by

Mohmad Ashik M A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

MySQL Interview Questions and Answers

If you are looking for a DBA(Database Administrator) job, You must have good knowledge
about Databases and MySQL queries. Please read the below MySQL interview questions
carefully to achieve a great position as a database administrator.

What Is the Difference Between MySQL and SQL Server?

Criteria MySQL SQL Server


Developed by Oracle Microsoft
Programmed In C and C++ Mainly C++, but some parts in C
Platforms Supports many platforms Supports only Linux and Windows
Syntax Complex Syntax Simpler and easy-to-use syntax

What is MySQL Server?

Ans. The MySQL server is one of the famous and user friendly database management system
[DBMS]. It is developed and designed by Oracle. Database management systems are the
computer system applications which can interact with users and various Database, too. Main
objectives of MySQL Server are as follows.

1. Analysing Data
2. Managing Definition and query
3. Creation, updating and administration of Database

Which port is set as default for MySQL Server?

Ans. 3306 is the default port for MySQL Server. 1433 is another standard default port used in
TCP/IP for SQL Server.

Why is SQL server famous in people?

Ans. User can download SQL Server for free and use it for developing SQL based
applications. It is easy to understand and use as a user.

Describe the features of MySQL.

Ans. MySQL provides a wide range of interface and supports different cross-platforms for
application programming. It supports many procedures like cursors and triggers that can be
used for managing the Database.

Visit https://errorsea.com/interview-questions/ for more interview questions and answers.


Explain in brief DDL, DCL and DML.

Ans. DDL stands for data definition language which deals with different database schemas
and descriptions about how Database resides in the Database. Create and ALTER table is the
example of a DDL statement.

DCL stands for the data control language, which deals with different types of permissions for
users.GRANT and REVOKE are examples of Data Control Language.

DML stands for data manipulation language, which deals with different manipulation
statements like INSERT, SELECT and UPDATE of the data.

Explain different types of joints in MySQL?

Ans. We can use joints for querying data from two or more tables. We can make a
relationship between two or more column of existing tables. Four types of joints are used in
MySQL. They are as follows:

1. Inner Join: It returns rows if one or more match found in both the tables.
2. Left Join: It returns all rows of the left side table if there is no match in the right side
table.
3. Right Join: It returns all rows of right side table if there is no match in the left side
table.
4. Full Join: It returns rows if there is at least one match in the tables

What is the main difference between char and varchar type?

Ans. When the user creates a table char type is used to define the fixed length of columns in
the table. The length value must be in the range of 1-255. The varchar is the variable-length
type which is used to adjust the column length of the table as per requirements.

Explain the standard MySQL functions CURRDATE, CURTIME,


CONCATE, DATEDIFF and NOW?

Ans. The mentioned functions can be described as given below.

 CURRDATE(): The function returns the current date


 CURTIME(): The function returns the current time
 CONCAT(X, Y): The function concatenates two string values and creates a single
string output
 NOW(): The function is used for returning the current date and time as a single value
 DATEDIFF (X, Y): The function returns the difference between two dates

Visit https://errorsea.com/interview-questions/ for more interview questions and answers.


Write syntax for concatenating tables in MySQL?

Ans. The syntax for concatenating tables in MySQL:

CONCAT (string 1, string 2, string 3)

Here string 1, string 2 and string 3 are strings which we want to concate as a string.

How can we get the current SQL version?

Ans. The below syntax is used for getting the current version of MySQL:

SELECT VERSION ();

Which types of strings are used in database columns in MySQL?

Ans. In MySQL, We can use SET, BLOB, VARCHAR, TEXT, ENUM, and CHAR type of
strings.

What is the limit of indexed columns created for a table?

Ans. The maximum limit of indexed columns that can be created for any table is 16.

Is it possible to use MySQL With Linux operating system?

Ans. Yes, We can use MySQL with the Linux operating system as follows:

etc/init.d/mysqlstart

The object-oriented version of MySQL library function is possible or not?

Ans. Yes, Object-oriented version of MySQL is possible. MYSQLi is one of the Object-
oriented version of MySQL library function.

Read also: Top 25 jQuery Interview Questions

What is the main difference between the primary key and candidate key?

Ans. The primary key is used to identify each row of a table uniquely. There can be more
than one primary key. We can use the candidate key to reference the foreign keys. The
primary key is one type of candidate key.

Visit https://errorsea.com/interview-questions/ for more interview questions and answers.


Explain the different types of tables in MySQL?

Ans. There are four different types of tables mainly used in MySQL.

 Heap: This table is used for fast data access, but the main disadvantage is that data
will be lost if the table or the system crashes.
 MyISAM: It is the default table that is based on the sequential access method.
 InnoDB: It is the table that supports transactions using the COMMIT and
ROLLBACK commands.
 BDB: It can support transactions similar to InnoDB, but the execution is slower.

What are Heap Tables?

Ans. Heap tables are used for high-speed temporary storage. But, TEXT and BLOB fields are
not allowed within them. They do not support AUTOINCREMENT.

How can the user take an incremental backup in MySQL?

Ans. Percona XtraBackup is used to take an incremental backup in MySQL.

What is the primary use of ENUM in MySQL?

Ans. ENUM can limit the values that can go into a table. For instance, we can create a table
giving specific day values and other day values would not enter into the table.

Which of the TRIGGERS can be used in MySQL tables?

Ans. Following TRIGGERS are allowed in MySQL:

 BEFORE INSERT
 AFTER INSERT
 BEFORE DELETE
 AFTER DELETE
 BEFORE UPDATE
 AFTER UPDATE

Explain the difference between REGEXP and LIKE operators in MySQL?

Ans. The identical difference between REGEXP and LIKE operators can be described as
mentioned below.

 LIKE is denoted using the ‘^’ sign.


 SELECT * FROM user WHERE username REGEXP “^NAME”;
 LIKE is denoted using the ‘%’ sign. For example:
 SELECT * FROM user WHERE user name LIKE “%NAME.”

Visit https://errorsea.com/interview-questions/ for more interview questions and answers.


How can the user change the root password if it is lost?

Ans. When the password of the user is lost, the user should start the Database with skip-
grants-table and then change the password. After that, the user should restart the DB with the
new password in a normal mode.

What is the main difference between the DELETE TABLE and TRUNCATE
TABLE commands in MySQL?

Ans. There is a slight difference between DELETE TABLE and TRUNCATE TABLE as
mentioned below.

 DELETE TABLE is a logged type operation, and every deleted row is logged.
Therefore, the process is prolonged.
 TRUNCATE TABLE also deletes rows in a table, but it will not log any of the
deleted rows.

So, the process is faster than DELETE TABLE in comparison. We can also roll back
TRUNCATE TABLE, and it functionally is similar to the DELETE statement without a
WHERE clause.

What are the primary storage models of OLAP?

Ans. The storage models in OLAP are as follows.

 MOLAP
 ROLAP
 HOLAP

Also read: Top 25 SQL Queries Interview Questions

Conclusion

That is all for MySQL Interview Questions for experienced, and if you are a fresher, don’t
worry if you were not able to answer some tricky questions. I am sure you will feel confident
after preparing for the MySQL interview using this series of questions.

I hope you found this post informative.

Thank you for reading :)

Visit https://errorsea.com/interview-questions/ for more interview questions and answers.

You might also like