MySQL Interview Questions
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.
Download PDF
Note that SQL is not case sensitive. However, it is a good practice to write the
SQL keywords in CAPS and other names and variables in a small case.
You can check out this SQL Tutorial to learn more about SQL.
Scaler Courses
SQL for Beginners: Learn SQL using MySQL and Database Design Course
A course by
Prateek Narang
Are you interested in learning SQL using MySQL? Look no further than our
comprehensive free online course! Scaler Topics SQL using MySQL free course is
designed with beginners in mind and will teach you the fundamentals of SQL and
MySQL, enabling you to build a solid foundation in database management.
5
Enrolled: 13491
Structured Curriculum
Experience expert-led learning with our industry-proven curriculum
Career Support
We're dedicated to helping you achieve your career goals
Explore Scaler for FREE
Intermediate MySQL Interview Questions
1. 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
2. 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]
3. What are MySQL Triggers?
A trigger is a task that executes in response to some predefined database event,
such as after 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
4. How many Triggers are possible in MySQL?
There are six Triggers allowed to use in the MySQL database:
Before Insert
After Insert
Before Update
After Update
Before Delete
After Delete
5. What is the MySQL server?
The server, mysqld, is the hub of a MySQL installation; it performs all
manipulation of databases and tables.
• 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).
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
1. 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.
Quantity of data
Number of users
User activity
Size of related datasets
3. 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.
Conclusion
1. 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 software
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/
Recommended Resources
SHOW;
CHARACTER SET;
Varchar
Char
Text type
True
False
5.
Which of the following is not a characteristic of MySQL?
Open Source
Portability
Slow speed
Ease of use
6.
Which of the following commands is used to create a database in MySQL?
MAKE DATABASE
CREATE DATABASE
7.
The connection parameters for setting up MySQL can be stored in an option file to
save typing the names every time a connection is established.
True
False
8.
What exports table definitions and contents in MySQL?
mysqladmin
mysqlimport
mysqldump
mysqlexport
9.
Which of the following commands will you use to load data files into tables?
mysqlimport
mysqldump
mysqlexport
mysqladmin
10.
Which declaration represents that “character data will consume the same number of
bytes as declared and is right padded”?
Char
Varchar
Varchar(20);