SlideShare a Scribd company logo
MySQL Interview Questions
To view the live version of the
page, click here.
© Copyright by Interviewbit
Basic MySQL Interview Questions
1.   What is MySQL?
2.   What are some of the advantages of using MySQL?
3.   What do you mean by ‘databases’?
4.   What does SQL in MySQL stand for?
5.   What does a MySQL database contain?
6.   How can you interact with MySQL?
7.   What are MySQL Database Queries?
8.   What are some of the common MySQL commands?
9.   How do you create a database in MySQL?
10.   How do you create a table using MySQL?
11.   How do you Insert Data Into MySQL?
12.   How do you remove a column from a database?
13.   How to create an Index in MySQL?
14.   How to Delete Data From a MySQL Table?
15.   How do you view a database in MySQL?
16.   What are the Numeric Data Types in MySQL?
17.   What are the String Data Types in MySQL?
18.   What are the Temporal Data Types in MySQL?
19.   What is BLOB in MySQL?
20.   How to add users in MySQL?
Page 1 © Copyright by Interviewbit
Contents
MySQL Interview Questions
Intermediate MySQL Interview Questions
21.   What are MySQL “Views”?
22.   How do you create and execute views in MySQL?
23.   What are MySQL Triggers?
24.   How many Triggers are possible in MySQL?
25.   What is the MySQL server?
26.   What are the MySQL clients and utilities?
27.   What are the types of relationships used in MySQL?
Advanced MySQL Interview Questions
28.   Can you explain the logical architecture of MySQL?
29.   What is Scaling in MySQL?
30.   What is Sharding in SQL?
31.   What are Transaction Storage Engines in MySQL?
Conclusion
32.   Conclusion
Page 2 © Copyright by Interviewbit
Introduction to MySQL:
MySQL is an open-source relational database management system (RDBMS). It runs
on the web as well as on the server. MySQL is fast, reliable, and easy to use. It is open-
source so ware. MySQL uses standard SQL and compiles on a number of platforms. It
is a multithreaded, multi-user SQL database management system.
The data in a MySQL database is stored in the form of tables. A table is a collection of
related data, and it consists of columns and rows.
MySQL has stand-alone clients that allow users to interact directly with a MySQL
database using SQL, but more o en MySQL is used with other programs to
implement applications that need relational database capability.
MySQL has more than 11 million installations.
Basic MySQL Interview Questions
1.   What is MySQL?
MySQL is a database management system for web servers. It can grow with the
website as it is highly scalable. Most of the websites today are powered by MySQL.
2.   What are some of the advantages of using MySQL?
Page 3 © Copyright by Interviewbit
Let's get Started
MySQL Interview Questions
Flexibility: MySQL runs on all operating systems
Power: MySQL focuses on performance
Enterprise-Level SQL Features: MySQL had for some time been lacking in
advanced features such as subqueries, views, and stored procedures.
Full-Text Indexing and Searching
Query Caching: This helps enhance the speed of MySQL greatly
Replication: One MySQL server can be duplicated on another, providing
numerous advantages
Configuration and Security
3.   What do you mean by ‘databases’?
A database is a structured collection of data stored in a computer system and
organized in a way to be quickly searched. With databases, information can be
rapidly retrieved.
4.   What does SQL in MySQL stand for?
The SQL in MySQL stands for Structured Query Language. This language is also used
in other databases such as Oracle and Microso SQL Server.  One can use commands
such as the following to send requests from a database:
SELECT title FROM publications WHERE author = ' J. K. Rowling’;
5.   What does a MySQL database contain?
A MySQL database contains one or more tables, each of which contains records or
rows. Within these rows are various columns or fields that contain the data itself.
6.   How can you interact with MySQL?
There are three main ways you can interact with MySQL: 
using a command line
via a web interface
through a programming language
Page 4 © Copyright by Interviewbit
Note that SQL is not case sensitive. However, it is a good practice to write the SQL ke
MySQL Interview Questions
7.   What are MySQL Database Queries?
A query is a specific request or a question. One can query a database for specific
information and have a record returned.
8.   What are some of the common MySQL commands?
Page 5 © Copyright by Interviewbit
MySQL Interview Questions
Command Action
ALTER To alter a database or table
BACKUP To back-up a table
c To cancel Input
CREATE To create a database
DELETE To delete a row from a table
DESCRIBE To describe a table's columns
DROP To delete a database or table
EXIT(ctrl+c) To exit
GRANT To change user privileges
HELP (h, ?) Display help
INSERT Insert data
LOCK Lock table(s)
QUIT(q) Same as EXIT
RENAME Rename a Table
SHOW List details about an object
SOURCE Execute a file
STATUS (s) Display the current status
TRUNCATE Empty a table
Page 6 © Copyright by Interviewbit
MySQL Interview Questions
9.   How do you create a database in MySQL?
Use the following command to create a new database called ‘books’:
CREATE DATABASE books;
10.   How do you create a table using MySQL?
Use the following to create a table using MySQL:
CREATE TABLE history (
author VARCHAR(128),
title VARCHAR(128),
type VARCHAR(16),
year CHAR(4)) ENGINE InnoDB;
11.   How do you Insert Data Into MySQL?
The INSERT INTO statement is used to add new records to a MySQL table:
INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...)
If we want to add values for all the columns of the table, we do not need to specify
the column names in the SQL query. However, the order of the values should be in
the same order as the columns in the table. The INSERT INTO syntax would be as
follows:
INSERT INTO table_name
VALUES (value1, value2, value3, ...);
12.   How do you remove a column from a database?
You can remove a column by using the DROP keyword:
ALTER TABLE classics DROP pages;
13.   How to create an Index in MySQL?
Page 7 © Copyright by Interviewbit
MySQL Interview Questions
In MySQL, there are different index types, such as a regular INDEX, a PRIMARY KEY, or
a FULLTEXT index. You can achieve fast searches with the help of an index. Indexes
speed up performance by either ordering the data on disk so it's quicker to find your
result or, telling the SQL engine where to go to find your data.
Example: Adding indexes to the history table:
ALTER TABLE history ADD INDEX(author(10));
ALTER TABLE history ADD INDEX(title(10));
ALTER TABLE history ADD INDEX(category(5));
ALTER TABLE history ADD INDEX(year);
DESCRIBE history;
14.   How to Delete Data From a MySQL Table?
In MySQL, the DELETE statement is used to delete records from a table:
DELETE FROM table_name
WHERE column_name = value_name
15.   How do you view a database in MySQL?
One can view all the databases on the MySQL server host using the following
command:
mysql> SHOW DATABASES;
16.   What are the Numeric Data Types in MySQL?
MySQL has numeric data types for integer, fixed-point, floating-point, and bit values,
as shown in the table below. Numeric types can be signed or unsigned, except BIT. A
special attribute enables the automatic generation of sequential integer or floating-
point column values, which is useful for applications that require a series of unique
identification numbers.
Page 8 © Copyright by Interviewbit
MySQL Interview Questions
Type Name Meaning
TINYINT Very Small Integer
SMALLINT Small Integer
MEDIUMINT Medium-sized Integer
INT Standard Integer
BIGINT Large Integer
DECIMAL Fixed-point number
FLOAT Single-precision floating-point number
DOUBLE Double-precision floating-point number
BIT Bit-field
17.   What are the String Data Types in MySQL?
Page 9 © Copyright by Interviewbit
MySQL Interview Questions
Type Name Meaning
CHAR fixed-length nonbinary(character) string
VARCHAR variable-length nonbinary string
BINARY fixed-length binary string
VARBINARY variable-length binary string
TINYBLOB Very small BLOB(binary large object)
BLOB Small BLOB
MEDIUMBLOB Medium-sized BLOB
LONGBLOB Large BLOB
TINYTEXT A very small nonbinary string
TEXT Small nonbinary string
MEDIUMTEXT Medium-sized nonbinary string
LONGTEXT Large nonbinary string
ENUM
An enumeration; each column value is
assigned, one enumeration member
SET
A set; each column value is assigned zero or
more set members
NULL
NULL in SQL is the term used to represent a
missing value. A NULL value in a table is a
value in a field that appears to be blank. This
value is different than a zero value or a field
that contains spaces.
Page 10 © Copyright by Interviewbit
MySQL Interview Questions
18.   What are the Temporal Data Types in MySQL?
Type Name Meaning
DATE A date value, in ' CCYY-MM-DD ' Format
TIME A Time value, in ' hh : mm :ss ' format
DATETIME
Date and time value, in ' CCYY-MM-DD hh : mm
:ss ' format
TIMESTAMP
A timestamp value, in ' CCYY-MM-DD hh : mm
:ss ' format
YEAR A year value, in CCYY or YY format
Example: To select the records with an Order Date of "2018-11-11" from a table:
SELECT * FROM Orders WHERE OrderDate='2018-11-11'
19.   What is BLOB in MySQL?
BLOB is an acronym that stands for a binary large object. It is used to hold a variable
amount of data.
There are four types of BLOB:
TINYBLOB
BLOB
MEDIUMBLOB
LONGBLOB
A BLOB can hold a very large amount of data. For example - documents, images, and
even videos. You could store your complete novel as a file in a BLOB if needed.
Page 11 © Copyright by Interviewbit
MySQL Interview Questions
20.   How to add users in MySQL?
You can add a User by using the CREATE command and specifying the necessary
credentials. For example:
CREATE USER ‘testuser’ IDENTIFIED BY ‘sample password’;
 
Intermediate MySQL Interview Questions
21.   What are MySQL “Views”?
In MySQL, a view consists of a set of rows that is returned if a particular query is
executed. This is also known as a ‘virtual table’. Views make it easy to retrieve the way
of making the query available via an alias. 
The advantages of views are:
Simplicity
Security
Maintainability
22.   How do you create and execute views in MySQL?
Creating a view is accomplished with the CREATE VIEW statement. As an example:
CREATE
[OR REPLACE]
[ALGORITHM = {MERGE | TEMPTABLE | UNDEFINED }]
[DEFINER = { user | CURRENT_USER }]
[SQL SECURITY { DEFINER | INVOKER }]
VIEW view_name [(column_list)]
AS select_statement
[WITH [CASCADED | LOCAL] CHECK OPTION]
23.   What are MySQL Triggers?
Page 12 © Copyright by Interviewbit
MySQL Interview Questions
A trigger is a task that executes in response to some predefined database event, such
as a er a new row is added to a particular table. Specifically, this event involves
inserting, modifying, or deleting table data, and the task can occur either prior to or
immediately following any such event. 
Triggers have many purposes, including:
Audit Trails
Validation
Referential integrity enforcement
24.   How many Triggers are possible in MySQL?
There are six Triggers allowed to use in the MySQL database:
Before Insert
A er Insert
Before Update
A er Update
Before Delete
A er Delete
25.   What is the MySQL server?
The server, mysqld, is the hub of a MySQL installation; it performs all manipulation of
databases and tables.
26.   What are the MySQL clients and utilities?
Several MySQL programs are available to help you communicate with the server. For
administrative tasks, some of the most important ones are listed here:
• mysql—An interactive program that enables you to send SQL statements to the
server and to view the results. You can also use mysql to execute batch scripts (text
files containing SQL statements).
• mysqladmin—An administrative program for performing tasks such as shutting
down the server, checking its configuration, or monitoring its status if it appears not
to be functioning properly.
Page 13 © Copyright by Interviewbit
MySQL Interview Questions
• mysqldump—A tool for backing up your databases or copying databases to another
server.
• mysqlcheck and myisamchk—Programs that help you perform table checking,
analysis, and optimization, as well as repairs if tables become damaged. mysqlcheck
works with MyISAM tables and to some extent with tables for other storage engines.
myisamchk is for use only with MyISAM tables.
27.   What are the types of relationships used in MySQL?
There are three categories of relationships in MySQL:
One-to-One: Usually, when two items have a one-to-one relationship, you just
include them as columns in the same table.
One-to-Many: One-to-many (or many-to-one) relationships occur when one row
in one table is linked to many rows in another table.
Many-to-Many: In a many-to-many relationship, many rows in one table are
linked to many rows in another table. To create this relationship, add a third
table containing the same key column from each of the other tables
Advanced MySQL Interview Questions
28.   Can you explain the logical architecture of MySQL?
The top layer contains the services most network-based client/server tools or servers
need such as connection handling, authentication, security, and so forth.
The second layer contains much of MySQL’s brains. This has the code for query
parsing, analysis, optimization, caching, and all the built-in functions.
The third layer contains the storage engines that are responsible for storing and
retrieving the data stored in MySQL.
Page 14 © Copyright by Interviewbit
MySQL Interview Questions
29.   What is Scaling in MySQL?
In MySQL, scaling capacity is actually the ability to handle the load, and it’s useful to
think of load from several different angles such as:
Quantity of data
Number of users
User activity
Size of related datasets
30.   What is Sharding in SQL?
The process of breaking up large tables into smaller chunks (called shards) that are
spread across multiple servers is called Sharding. 
The advantage of Sharding is that since the sharded database is generally much
smaller than the original; queries, maintenance, and all other tasks are much faster.
31.   What are Transaction Storage Engines in MySQL?
To be able to use MySQL’s transaction facility, you have to be using MySQL’s InnoDB
storage engine (which is the default from version 5.5 onward). If you are not sure
which version of MySQL your code will be running on, rather than assuming InnoDB is
the default engine you can force its use when creating a table, as follows.
Page 15 © Copyright by Interviewbit
MySQL Interview Questions
Conclusion
32.   Conclusion
Several free or low-cost database management systems are available from which to
choose, such as MySQL, PostgreSQL, or SQLite.
When you compare MySQL with other database systems, think about what’s most
important to you. Performance, features (such as SQL conformance or extensions),
support, licensing conditions, and price all are factors to take into account.
MySQL is one of the best RDBMS being used for developing various web-based
so ware applications.
MySQL is offered under two different editions: the open-source MySQL Community
Server and the proprietary Enterprise Server.
Given these considerations, MySQL has many attractive qualities:
Speed
Ease of use
Query language support
Capability
Connectivity and security
Portability
Availability and cost
Open distribution and source code
Few MySQL References: 
https://www.mysql.com
https://learning.oreilly.com/library/view/learning-mysql/0596008643/
Page 16 © Copyright by Interviewbit
C Interview Questions Php Interview Questions C Sharp Interview Questions
Web Api Interview
Questions
Hibernate Interview
Questions
Node Js Interview Questions
Cpp Interview Questions Oops Interview Questions Devops Interview Questions
Machine Learning Interview
Questions
Docker Interview Questions Mysql Interview Questions
Css Interview Questions Laravel Interview Questions Asp Net Interview Questions
Django Interview Questions Dot Net Interview Questions Kubernetes Interview
Questions
Operating System Interview
Questions
React Native Interview
Questions
Aws Interview Questions
Git Interview Questions Java 8 Interview Questions Mongodb Interview
Questions
Dbms Interview Questions Spring Boot Interview
Questions
Power Bi Interview Questions
Pl Sql Interview Questions Tableau Interview
Questions
Linux Interview Questions
Ansible Interview Questions Java Interview Questions Jenkins Interview Questions
Page 17 © Copyright by Interviewbit
Links to More Interview
Questions

More Related Content

Similar to MySQL-Interview_Questions.pdf (20)

PPTX
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
WrushabhShirsat3
 
PPTX
unit-ii.pptx
NilamHonmane
 
PDF
Mysql basics1
Steffy Robert
 
PDF
ITI COPA MySQL MCQ Database Concept (DBMS)
SONU HEETSON
 
PPT
MySql slides (ppt)
webhostingguy
 
PPTX
Introduction To MySQL Lecture 1
Ajay Khatri
 
PPTX
Using Mysql.pptx
StephenEfange3
 
PPTX
sql.pptx
slavskrillex
 
PDF
My sql università di enna a.a. 2005-06
YUCHENG HU
 
PPTX
sql12.pptxsql12.pptxsql12.pptxsql12.pptx
usha raj
 
PPTX
unit 1_unit1_unit1_unit 1_unit1_unit1_ ppt.pptx
townhallforme1
 
PPTX
Mysql-overview.pptx
TamilHunt
 
PPTX
unit 1 ppt.pptx
VillainMass
 
PDF
Sql12
tacex1
 
PPT
MySQL Database System Hiep Dinh
webhostingguy
 
PPT
mysqlHiep.ppt
webhostingguy
 
PDF
working with database using mysql
Subhasis Nayak
 
PDF
Php, mysq lpart5(mysql)
Subhasis Nayak
 
PPTX
Introduction databases and MYSQL
Naeem Junejo
 
PPTX
PHP mysql Introduction database
Mudasir Syed
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
WrushabhShirsat3
 
unit-ii.pptx
NilamHonmane
 
Mysql basics1
Steffy Robert
 
ITI COPA MySQL MCQ Database Concept (DBMS)
SONU HEETSON
 
MySql slides (ppt)
webhostingguy
 
Introduction To MySQL Lecture 1
Ajay Khatri
 
Using Mysql.pptx
StephenEfange3
 
sql.pptx
slavskrillex
 
My sql università di enna a.a. 2005-06
YUCHENG HU
 
sql12.pptxsql12.pptxsql12.pptxsql12.pptx
usha raj
 
unit 1_unit1_unit1_unit 1_unit1_unit1_ ppt.pptx
townhallforme1
 
Mysql-overview.pptx
TamilHunt
 
unit 1 ppt.pptx
VillainMass
 
Sql12
tacex1
 
MySQL Database System Hiep Dinh
webhostingguy
 
mysqlHiep.ppt
webhostingguy
 
working with database using mysql
Subhasis Nayak
 
Php, mysq lpart5(mysql)
Subhasis Nayak
 
Introduction databases and MYSQL
Naeem Junejo
 
PHP mysql Introduction database
Mudasir Syed
 

More from Samir P. (14)

PDF
Operating-System-HandWritten-Notes.pdf
Samir P.
 
PDF
Martin Kleppmann-Designing Data-Intensive Applications_ The Big Ideas Behind ...
Samir P.
 
PDF
Networking-Interview-Questions-Answers.pdf
Samir P.
 
PDF
Networking_Interview_Questions.pdf
Samir P.
 
PDF
Operating_System_Interview_Questions.pdf
Samir P.
 
PDF
Python_Interview_Questions.pdf
Samir P.
 
PDF
DBMS-Interview_Questions.pdf
Samir P.
 
PDF
OOPs-Interview-Questions.pdf
Samir P.
 
PDF
Web-Services-Interview-Questions.pdf
Samir P.
 
PDF
MySQL_Commands.pdf
Samir P.
 
PDF
System-Design-Interview-Questions.pdf
Samir P.
 
PDF
Application-Servers.pdf
Samir P.
 
PDF
Web-Testing_Interview_Questionspdf.pdf
Samir P.
 
PDF
DBMS-Handwritten-Notes-All-Concepts.pdf
Samir P.
 
Operating-System-HandWritten-Notes.pdf
Samir P.
 
Martin Kleppmann-Designing Data-Intensive Applications_ The Big Ideas Behind ...
Samir P.
 
Networking-Interview-Questions-Answers.pdf
Samir P.
 
Networking_Interview_Questions.pdf
Samir P.
 
Operating_System_Interview_Questions.pdf
Samir P.
 
Python_Interview_Questions.pdf
Samir P.
 
DBMS-Interview_Questions.pdf
Samir P.
 
OOPs-Interview-Questions.pdf
Samir P.
 
Web-Services-Interview-Questions.pdf
Samir P.
 
MySQL_Commands.pdf
Samir P.
 
System-Design-Interview-Questions.pdf
Samir P.
 
Application-Servers.pdf
Samir P.
 
Web-Testing_Interview_Questionspdf.pdf
Samir P.
 
DBMS-Handwritten-Notes-All-Concepts.pdf
Samir P.
 
Ad

Recently uploaded (20)

PDF
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
Dimensions of Societal Planning in Commonism
StefanMz
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
Ad

MySQL-Interview_Questions.pdf

  • 1. MySQL Interview Questions To view the live version of the page, click here. © Copyright by Interviewbit
  • 2. Basic MySQL Interview Questions 1.   What is MySQL? 2.   What are some of the advantages of using MySQL? 3.   What do you mean by ‘databases’? 4.   What does SQL in MySQL stand for? 5.   What does a MySQL database contain? 6.   How can you interact with MySQL? 7.   What are MySQL Database Queries? 8.   What are some of the common MySQL commands? 9.   How do you create a database in MySQL? 10.   How do you create a table using MySQL? 11.   How do you Insert Data Into MySQL? 12.   How do you remove a column from a database? 13.   How to create an Index in MySQL? 14.   How to Delete Data From a MySQL Table? 15.   How do you view a database in MySQL? 16.   What are the Numeric Data Types in MySQL? 17.   What are the String Data Types in MySQL? 18.   What are the Temporal Data Types in MySQL? 19.   What is BLOB in MySQL? 20.   How to add users in MySQL? Page 1 © Copyright by Interviewbit Contents
  • 3. MySQL Interview Questions Intermediate MySQL Interview Questions 21.   What are MySQL “Views”? 22.   How do you create and execute views in MySQL? 23.   What are MySQL Triggers? 24.   How many Triggers are possible in MySQL? 25.   What is the MySQL server? 26.   What are the MySQL clients and utilities? 27.   What are the types of relationships used in MySQL? Advanced MySQL Interview Questions 28.   Can you explain the logical architecture of MySQL? 29.   What is Scaling in MySQL? 30.   What is Sharding in SQL? 31.   What are Transaction Storage Engines in MySQL? Conclusion 32.   Conclusion Page 2 © Copyright by Interviewbit
  • 4. Introduction to MySQL: MySQL is an open-source relational database management system (RDBMS). It runs on the web as well as on the server. MySQL is fast, reliable, and easy to use. It is open- source so ware. MySQL uses standard SQL and compiles on a number of platforms. It is a multithreaded, multi-user SQL database management system. The data in a MySQL database is stored in the form of tables. A table is a collection of related data, and it consists of columns and rows. MySQL has stand-alone clients that allow users to interact directly with a MySQL database using SQL, but more o en MySQL is used with other programs to implement applications that need relational database capability. MySQL has more than 11 million installations. Basic MySQL Interview Questions 1.   What is MySQL? MySQL is a database management system for web servers. It can grow with the website as it is highly scalable. Most of the websites today are powered by MySQL. 2.   What are some of the advantages of using MySQL? Page 3 © Copyright by Interviewbit Let's get Started
  • 5. MySQL Interview Questions Flexibility: MySQL runs on all operating systems Power: MySQL focuses on performance Enterprise-Level SQL Features: MySQL had for some time been lacking in advanced features such as subqueries, views, and stored procedures. Full-Text Indexing and Searching Query Caching: This helps enhance the speed of MySQL greatly Replication: One MySQL server can be duplicated on another, providing numerous advantages Configuration and Security 3.   What do you mean by ‘databases’? A database is a structured collection of data stored in a computer system and organized in a way to be quickly searched. With databases, information can be rapidly retrieved. 4.   What does SQL in MySQL stand for? The SQL in MySQL stands for Structured Query Language. This language is also used in other databases such as Oracle and Microso SQL Server.  One can use commands such as the following to send requests from a database: SELECT title FROM publications WHERE author = ' J. K. Rowling’; 5.   What does a MySQL database contain? A MySQL database contains one or more tables, each of which contains records or rows. Within these rows are various columns or fields that contain the data itself. 6.   How can you interact with MySQL? There are three main ways you can interact with MySQL:  using a command line via a web interface through a programming language Page 4 © Copyright by Interviewbit Note that SQL is not case sensitive. However, it is a good practice to write the SQL ke
  • 6. MySQL Interview Questions 7.   What are MySQL Database Queries? A query is a specific request or a question. One can query a database for specific information and have a record returned. 8.   What are some of the common MySQL commands? Page 5 © Copyright by Interviewbit
  • 7. MySQL Interview Questions Command Action ALTER To alter a database or table BACKUP To back-up a table c To cancel Input CREATE To create a database DELETE To delete a row from a table DESCRIBE To describe a table's columns DROP To delete a database or table EXIT(ctrl+c) To exit GRANT To change user privileges HELP (h, ?) Display help INSERT Insert data LOCK Lock table(s) QUIT(q) Same as EXIT RENAME Rename a Table SHOW List details about an object SOURCE Execute a file STATUS (s) Display the current status TRUNCATE Empty a table Page 6 © Copyright by Interviewbit
  • 8. MySQL Interview Questions 9.   How do you create a database in MySQL? Use the following command to create a new database called ‘books’: CREATE DATABASE books; 10.   How do you create a table using MySQL? Use the following to create a table using MySQL: CREATE TABLE history ( author VARCHAR(128), title VARCHAR(128), type VARCHAR(16), year CHAR(4)) ENGINE InnoDB; 11.   How do you Insert Data Into MySQL? The INSERT INTO statement is used to add new records to a MySQL table: INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...) If we want to add values for all the columns of the table, we do not need to specify the column names in the SQL query. However, the order of the values should be in the same order as the columns in the table. The INSERT INTO syntax would be as follows: INSERT INTO table_name VALUES (value1, value2, value3, ...); 12.   How do you remove a column from a database? You can remove a column by using the DROP keyword: ALTER TABLE classics DROP pages; 13.   How to create an Index in MySQL? Page 7 © Copyright by Interviewbit
  • 9. MySQL Interview Questions In MySQL, there are different index types, such as a regular INDEX, a PRIMARY KEY, or a FULLTEXT index. You can achieve fast searches with the help of an index. Indexes speed up performance by either ordering the data on disk so it's quicker to find your result or, telling the SQL engine where to go to find your data. Example: Adding indexes to the history table: ALTER TABLE history ADD INDEX(author(10)); ALTER TABLE history ADD INDEX(title(10)); ALTER TABLE history ADD INDEX(category(5)); ALTER TABLE history ADD INDEX(year); DESCRIBE history; 14.   How to Delete Data From a MySQL Table? In MySQL, the DELETE statement is used to delete records from a table: DELETE FROM table_name WHERE column_name = value_name 15.   How do you view a database in MySQL? One can view all the databases on the MySQL server host using the following command: mysql> SHOW DATABASES; 16.   What are the Numeric Data Types in MySQL? MySQL has numeric data types for integer, fixed-point, floating-point, and bit values, as shown in the table below. Numeric types can be signed or unsigned, except BIT. A special attribute enables the automatic generation of sequential integer or floating- point column values, which is useful for applications that require a series of unique identification numbers. Page 8 © Copyright by Interviewbit
  • 10. MySQL Interview Questions Type Name Meaning TINYINT Very Small Integer SMALLINT Small Integer MEDIUMINT Medium-sized Integer INT Standard Integer BIGINT Large Integer DECIMAL Fixed-point number FLOAT Single-precision floating-point number DOUBLE Double-precision floating-point number BIT Bit-field 17.   What are the String Data Types in MySQL? Page 9 © Copyright by Interviewbit
  • 11. MySQL Interview Questions Type Name Meaning CHAR fixed-length nonbinary(character) string VARCHAR variable-length nonbinary string BINARY fixed-length binary string VARBINARY variable-length binary string TINYBLOB Very small BLOB(binary large object) BLOB Small BLOB MEDIUMBLOB Medium-sized BLOB LONGBLOB Large BLOB TINYTEXT A very small nonbinary string TEXT Small nonbinary string MEDIUMTEXT Medium-sized nonbinary string LONGTEXT Large nonbinary string ENUM An enumeration; each column value is assigned, one enumeration member SET A set; each column value is assigned zero or more set members NULL NULL in SQL is the term used to represent a missing value. A NULL value in a table is a value in a field that appears to be blank. This value is different than a zero value or a field that contains spaces. Page 10 © Copyright by Interviewbit
  • 12. MySQL Interview Questions 18.   What are the Temporal Data Types in MySQL? Type Name Meaning DATE A date value, in ' CCYY-MM-DD ' Format TIME A Time value, in ' hh : mm :ss ' format DATETIME Date and time value, in ' CCYY-MM-DD hh : mm :ss ' format TIMESTAMP A timestamp value, in ' CCYY-MM-DD hh : mm :ss ' format YEAR A year value, in CCYY or YY format Example: To select the records with an Order Date of "2018-11-11" from a table: SELECT * FROM Orders WHERE OrderDate='2018-11-11' 19.   What is BLOB in MySQL? BLOB is an acronym that stands for a binary large object. It is used to hold a variable amount of data. There are four types of BLOB: TINYBLOB BLOB MEDIUMBLOB LONGBLOB A BLOB can hold a very large amount of data. For example - documents, images, and even videos. You could store your complete novel as a file in a BLOB if needed. Page 11 © Copyright by Interviewbit
  • 13. MySQL Interview Questions 20.   How to add users in MySQL? You can add a User by using the CREATE command and specifying the necessary credentials. For example: CREATE USER ‘testuser’ IDENTIFIED BY ‘sample password’;   Intermediate MySQL Interview Questions 21.   What are MySQL “Views”? In MySQL, a view consists of a set of rows that is returned if a particular query is executed. This is also known as a ‘virtual table’. Views make it easy to retrieve the way of making the query available via an alias.  The advantages of views are: Simplicity Security Maintainability 22.   How do you create and execute views in MySQL? Creating a view is accomplished with the CREATE VIEW statement. As an example: CREATE [OR REPLACE] [ALGORITHM = {MERGE | TEMPTABLE | UNDEFINED }] [DEFINER = { user | CURRENT_USER }] [SQL SECURITY { DEFINER | INVOKER }] VIEW view_name [(column_list)] AS select_statement [WITH [CASCADED | LOCAL] CHECK OPTION] 23.   What are MySQL Triggers? Page 12 © Copyright by Interviewbit
  • 14. MySQL Interview Questions A trigger is a task that executes in response to some predefined database event, such as a er a new row is added to a particular table. Specifically, this event involves inserting, modifying, or deleting table data, and the task can occur either prior to or immediately following any such event.  Triggers have many purposes, including: Audit Trails Validation Referential integrity enforcement 24.   How many Triggers are possible in MySQL? There are six Triggers allowed to use in the MySQL database: Before Insert A er Insert Before Update A er Update Before Delete A er Delete 25.   What is the MySQL server? The server, mysqld, is the hub of a MySQL installation; it performs all manipulation of databases and tables. 26.   What are the MySQL clients and utilities? Several MySQL programs are available to help you communicate with the server. For administrative tasks, some of the most important ones are listed here: • mysql—An interactive program that enables you to send SQL statements to the server and to view the results. You can also use mysql to execute batch scripts (text files containing SQL statements). • mysqladmin—An administrative program for performing tasks such as shutting down the server, checking its configuration, or monitoring its status if it appears not to be functioning properly. Page 13 © Copyright by Interviewbit
  • 15. MySQL Interview Questions • mysqldump—A tool for backing up your databases or copying databases to another server. • mysqlcheck and myisamchk—Programs that help you perform table checking, analysis, and optimization, as well as repairs if tables become damaged. mysqlcheck works with MyISAM tables and to some extent with tables for other storage engines. myisamchk is for use only with MyISAM tables. 27.   What are the types of relationships used in MySQL? There are three categories of relationships in MySQL: One-to-One: Usually, when two items have a one-to-one relationship, you just include them as columns in the same table. One-to-Many: One-to-many (or many-to-one) relationships occur when one row in one table is linked to many rows in another table. Many-to-Many: In a many-to-many relationship, many rows in one table are linked to many rows in another table. To create this relationship, add a third table containing the same key column from each of the other tables Advanced MySQL Interview Questions 28.   Can you explain the logical architecture of MySQL? The top layer contains the services most network-based client/server tools or servers need such as connection handling, authentication, security, and so forth. The second layer contains much of MySQL’s brains. This has the code for query parsing, analysis, optimization, caching, and all the built-in functions. The third layer contains the storage engines that are responsible for storing and retrieving the data stored in MySQL. Page 14 © Copyright by Interviewbit
  • 16. MySQL Interview Questions 29.   What is Scaling in MySQL? In MySQL, scaling capacity is actually the ability to handle the load, and it’s useful to think of load from several different angles such as: Quantity of data Number of users User activity Size of related datasets 30.   What is Sharding in SQL? The process of breaking up large tables into smaller chunks (called shards) that are spread across multiple servers is called Sharding.  The advantage of Sharding is that since the sharded database is generally much smaller than the original; queries, maintenance, and all other tasks are much faster. 31.   What are Transaction Storage Engines in MySQL? To be able to use MySQL’s transaction facility, you have to be using MySQL’s InnoDB storage engine (which is the default from version 5.5 onward). If you are not sure which version of MySQL your code will be running on, rather than assuming InnoDB is the default engine you can force its use when creating a table, as follows. Page 15 © Copyright by Interviewbit
  • 17. MySQL Interview Questions Conclusion 32.   Conclusion Several free or low-cost database management systems are available from which to choose, such as MySQL, PostgreSQL, or SQLite. When you compare MySQL with other database systems, think about what’s most important to you. Performance, features (such as SQL conformance or extensions), support, licensing conditions, and price all are factors to take into account. MySQL is one of the best RDBMS being used for developing various web-based so ware applications. MySQL is offered under two different editions: the open-source MySQL Community Server and the proprietary Enterprise Server. Given these considerations, MySQL has many attractive qualities: Speed Ease of use Query language support Capability Connectivity and security Portability Availability and cost Open distribution and source code Few MySQL References:  https://www.mysql.com https://learning.oreilly.com/library/view/learning-mysql/0596008643/ Page 16 © Copyright by Interviewbit
  • 18. C Interview Questions Php Interview Questions C Sharp Interview Questions Web Api Interview Questions Hibernate Interview Questions Node Js Interview Questions Cpp Interview Questions Oops Interview Questions Devops Interview Questions Machine Learning Interview Questions Docker Interview Questions Mysql Interview Questions Css Interview Questions Laravel Interview Questions Asp Net Interview Questions Django Interview Questions Dot Net Interview Questions Kubernetes Interview Questions Operating System Interview Questions React Native Interview Questions Aws Interview Questions Git Interview Questions Java 8 Interview Questions Mongodb Interview Questions Dbms Interview Questions Spring Boot Interview Questions Power Bi Interview Questions Pl Sql Interview Questions Tableau Interview Questions Linux Interview Questions Ansible Interview Questions Java Interview Questions Jenkins Interview Questions Page 17 © Copyright by Interviewbit Links to More Interview Questions