What is MySQL?
MySQL is a relational database management system. We use it to store data in
tables, and the rows of those tables can be related to each other by common
information in the columns. The basic idea is that we have one or more "tables"
(or "databases") and a set of rows (records) and columns (fields). Other elements,
like keys and indexes, help to define them further.
• MySQL is a relational database management system
• MySQL is open-source
• MySQL is free
• MySQL is ideal for both small and large applications
• MySQL is very fast, reliable, scalable, and easy to use
Database & RDBMS :
A database is a place in which data is stored and organized.
RDBMS stands for Relational Database Management System. The word
“relational” means that the data stored in the dataset is organized as tables.
Every table relates in some ways.
MySQL and SQL are not the same. MySQL is one of the most popular
RDBMS software’s brand names, which implements a client-server model.
And Using Structured Query Language (SQL) - a domain-specific language,
the client and server communicate in an RDBMS environment.
SQL statements can instruct the server to perform certain operations:
• Data query: requesting specific information from the existing
database.
• Data manipulation: adding, deleting, changing, sorting, and other
operations to modify the data, the values or the visuals.
• Data identity: defining data types, e.g. changing numerical data to
integers. This also includes defining a schema or the relationship of
each table in the database
• Data access control: providing security techniques to protect data,
this includes deciding who can view or use any information stored in
the database
Why is MySQL so Popular?
• Flexible and easy to use
• High performance
• Secure
How Does MySQL Work?
The image explains the basic structure of the client-server structure. One or
more devices (clients) connect to a server through a specific network. Every
client can make a request from the graphical user interface (GUI) on their
screens, and the server will produce the desired output, as long as both ends
understand the instruction. The main processes taking place in a MySQL
environment are the same, which are:
1. MySQL creates a database for storing and manipulating data, defining
the relationship of each table.
2. Clients can make requests by typing specific SQL statements on
MySQL.
3. The server application will respond with the requested information and
it will appear on the clients’ side.
These SQL commands are mainly categorized into five categories as:
1. DDL – Data Definition Language
DDL or Data Definition Language actually consists of the SQL
commands that can be used to define the database schema.
2. DML – Data Manipulation Language
The SQL commands that deals with the manipulation of data
present in the database belong to DML or Data Manipulation Language
and this includes most of the SQL statements.
3. DCL – Data Control Language
DCL includes commands such as GRANT and REVOKE which
mainly deal with the rights, permissions, and other controls of the database
system.
4. TCL – Transaction Control Language
TCL commands are used to control the execution of a transaction
5. DQL – Data Query Language
We can define DQL as follows it is a component of SQL
statement that allows getting data from the database and imposing order
upon it.
Some of The Most Important SQL Commands
• SELECT - extracts data from a database
• UPDATE - updates data in a database
• DELETE - deletes data from a database
• INSERT INTO - inserts new data into a database
• CREATE DATABASE - creates a new database
• ALTER DATABASE - modifies a database
• CREATE TABLE - creates a new table
• ALTER TABLE - modifies a table
• DROP TABLE - deletes a table
• CREATE INDEX - creates an index (search key)
• DROP INDEX - deletes an index
• TRUNCATE - This is used to remove all records from a table,
including all spaces allocated for the records are removed.
• GRANT - This command gives users access privileges to the database.
• REVOKE - This command withdraws the user’s access privileges given
by using the GRANT command.
• BEGIN - Opens a Transaction.
• COMMIT - Commits a Transaction.
• ROLLBACK - Rollbacks a transaction in case of any error occurs.
• SAVEPOINT - Sets a save point within a transaction.
• SET TRANSACTION - Specifies characteristics for the transaction.
Disadvantages of MySQL:
• MySQL is not very efficient in handling very large databases.
• MySQL doesn’t have as good a developing and debugging tool as
compared to paid databases.
• MySQL versions less than 5.0 do not support COMMIT, stored procedure
and ROLE.
• MySQL is prone to data corruption as it inefficient in handling
transactions.
• MySQL does not support SQL check constraints.