Introduction
MySQL is one of the most popular open-source Relational Database Management Systems (RDBMS).
A MySQL client might hold multiple databases. Each database might contain multiple tables with each table holding data of the same type. Each table contains rows and columns with each row denoting a single entry and each column denoting different attributes of the entries.
Features of MySQL
- Speed - It is considered one of the fast database languages.
- Cost - It can be downloaded free of cost from the official website.
- Easy to use - It is very easy to use.
- Security - It has a very strong data security layer which makes it secure.
- Scalability - It works with small and large data, and is very scalable.
Some important MySQL commands
- CREATE - Create a database or table.
- DROP - Delete a database or table.
- ALTER - Modify a database or table.
- SELECT - Query data.
- INSERT - Insert data.
- UPDATE - Update data.
- DELETE - Delete data.
Data Types in MySQL
MySQL supports a list of predefined data types that we can use to effectively model our tables. These data types are:
- INT: for integer data.
- DECIMAL: for decimal data.
- BOOLEAN: for boolean data.
- CHAR: for fixed-length string.
- VARCHAR: for variable-length string.
- TEXT: for long-form text.
- DATE: for date data.
- TIME: for time data.
- DATETIME: for date-time data.
- TIMESTAMP: for timestamp data.
Creation of Table
CREATE TABLE statement is used to create a table in MySQL.
Syntax: CREATE TABLE table_name (column_name column_type);
Deletion of Table
DROP statement is used to delete a table.
Modifying a Table
ALTER statement is used to modify a table.
Querying Data in MySQL
One of the most important functions that a database provides is querying the stored data with or without filters and sorts. We can query data from MySQL using the SELECT clause.
Modifying Data in MySQL
MySQL allows us to insert, update and delete data through INSERT, UPDATE, REPLACE and DELETE clauses.
Grouping Data in MySQL
MySQL allows us to do a grouping of rows to get some aggregated values through the GROUP BY clause. It returns one row per group.
Joining Tables in MySQL
To get data across multiple tables joins are needed. MySQL provides commands for INNER JOIN, LEFT JOIN, RIGHT JOIN, and CROSS JOIN. It does not support FULL OUTER JOIN.