Basic MySQL Interview Questions
Basic MySQL Interview Questions
1. What is MySQL?
MySQL is a fast, stable, and reliable solution that provides advantages like:
• Full-text Indexing and Searching – has support for full-text indexing and
searching
'My' in MySQL represents the first name of its co-founder, Michael Widenius'
daughter, My Widenius. SQL is an abbreviation for the term "Structured Query
Language". SQL is also used in databases like Oracle and Microsoft SQL Server.
A MySQL database contains one or many tables, with each table containing several
records or rows. Within these rows, data is contained in various columns or fields.
They are:
• MyISAM
• HeapMerge
• INNO DB
• ISAM
A query is a request for data or information from a database. Users can query a
database for specific information, and the resultant record/records are returned by
MySQL.
• EXIT – to exit
'author' VARCHAR(128),
'title' VARCHAR(128),
'type' VARCHAR(16),
'year' CHAR(4))
ENGINE = InnoDB;
The INSERT INTO statement is used to insert new records in a table in MySQL.
Syntax:
The SHOW DATABASES command allows the user to view all databases on the
MySQL server host.
There are two ways to import database or move data from one place to another:
• MySQL Workbench
Examples:
BIT - Bit-field
• CHAR
• VARCHAR
• BINARY
• VARBINARY
• TINYBLOB
• BLOB
• MEDIUMBLOB
• LONGBLOB
• TINYTEXT
• TEXT
• MEDIUMTEXT
• LONGTEXT
• ENUM
• SET
• NULL
MySQL provides temporal data types for date and time, as well as a combination of
date and time. These are:
BLOB is an acronym for a binary large object. It is a string data type used to hold a
variable amount of data.
• Before Insert
• After Insert
• Before Update
• After Update
• Before Delete
• After Delete
The server 'mysqld' is the MySQL server, which performs all manipulation of
databases and tables.
There are several MSQL programs available to help users communicate with the
server. Some important ones for administrative tasks are:
.mysql – this interactive program helps to send SQL statements to the server and
view the results. One can even use MySQL to use batch scripts.
.mysqladmin – this administrative program helps perform tasks like shutting down
the server, checking configuration, monitoring status if it is not functioning properly.
The top layer comprises the services required by most network-based client/server
tools like connection handling, security, authentication, etc.
The 2nd layer comprises code for query parsing, optimization, analysis, caching, and
all built-in functions.
The 3rd layer comprises storage engines where storage and retrieval of data stored
in MySQL is performed.
Scaling capacity in MySQL is the ability to handle the load in terms of:
• Data quantity
• Number of users
• User activity
The process of breaking up large tables into smaller chunks or shards spread across
many servers is called sharding. It makes querying, maintenance, and other tasks
faster.