MySQL Interview Questions and Answers For Experienced and Freshers
MySQL Interview Questions and Answers For Experienced and Freshers
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.
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
Ans. 3306 is the default port for MySQL Server. 1433 is another standard default port used in
TCP/IP for SQL Server.
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.
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.
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.
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
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.
Here string 1, string 2 and string 3 are strings which we want to concate as a string.
Ans. The below syntax is used for getting the current version of MySQL:
Ans. In MySQL, We can use SET, BLOB, VARCHAR, TEXT, ENUM, and CHAR type of
strings.
Ans. The maximum limit of indexed columns that can be created for any table is 16.
Ans. Yes, We can use MySQL with the Linux operating system as follows:
etc/init.d/mysqlstart
Ans. Yes, Object-oriented version of MySQL is possible. MYSQLi is one of the Object-
oriented version of MySQL library function.
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.
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.
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.
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.
BEFORE INSERT
AFTER INSERT
BEFORE DELETE
AFTER DELETE
BEFORE UPDATE
AFTER UPDATE
Ans. The identical difference between REGEXP and LIKE operators can be described as
mentioned below.
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.
MOLAP
ROLAP
HOLAP
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.