MySQL Tutorial
MySQL is the most popular relational database management system. In terms of web applications, MySQL is one of the best RDBMS (Relational Database Management System) application software.
In this tutorial, you will quickly grasp the basics of MySQL and easily use the MySQL database.
Online testing tools:https://www.jyshare.com/front-end/7768/。
What is a database?
A database is a warehouse that organizes, stores, and manages data according to data structures.
Each database has one or more different APIs for creating, accessing, managing, searching, and copying the data it stores.
We can also store data in files, but reading and writing data in files is relatively slow.
Therefore, we now use relational database management systems (RDBMS) to store and manage large amounts of data. A so-called relational database is a database built on the relational model, using mathematical concepts and methods such as relational algebra to process data in the database.
RDBMS, i.e., Relational Database Management System, has the following characteristics:
- 1. Data appears in the form of tables.
- 2. Each row represents various record names.
- 3. Each column is the data field corresponding to the record name.
- 4. Many rows and columns form a table.
- 5. Several tables form a database.
RDBMS Terminology
Before we start learning MySQL database, let's first understand some RDBMS terminology:
- Database:A database is a collection of related tables.
- Data table:A table is a matrix of data. A table in a database looks like a simple spreadsheet.
- Column:A column (data element) contains data of the same type, such as postal code data.
- Row:A row (tuple, or record) is a group of related data, such as a piece of user subscription data.
- Redundancy: Storing twice the data. Redundancy reduces performance but improves data security.
- Primary key: A primary key is unique. A data table can contain only one primary key. You can use the primary key to query data.
- Foreign key:A foreign key is used to relate two tables.
- Composite key: A composite key (combined key) uses multiple columns as an index key, generally used for composite indexes.
- Index:Using an index allows quick access to specific information in a database table. An index is a structure that sorts the values of one or more columns in a database table. It is similar to a book's table of contents.
- Referential integrity:Referential integrity requires that relationships do not allow references to nonexistent entities. Together with entity integrity, it is an integrity constraint that the relational model must satisfy, with the purpose of ensuring data consistency.
MySQL is a relational database management system (RDBMS). This so-called "relational" can be understood as the concept of "tables". A relational database consists of one or several tables, as shown in the table below:

- Header: the name of each column;
- Column (col): a collection of data with the same data type;
- Row: each row describes specific information about a record;
- Value: the specific information of a row; each value must be the same as the data type of that column;
- Key: The value of a key is unique in the current column.
MySQL Database
MySQL is a relational database management system developed by MySQL AB in Sweden and currently owned by Oracle Corporation. MySQL is a relational database management system. Relational databases store data in different tables rather than putting all data in one large warehouse, which increases speed and improves flexibility.
- MySQL is open source and is currently a product under Oracle.
- MySQL supports large databases. It can handle large databases with tens of millions of records.
- MySQL uses the standard SQL data language format.
- MySQL can run on multiple systems and supports multiple languages. These programming languages include C, C++, Python, Java, Perl, PHP, Eiffel, Ruby, and Tcl, etc.
- MySQL has good support for PHP. PHP is well suited for web application development.
- MySQL supports large databases, supporting data warehouses with up to 50 million records. The maximum table file size is 4GB on 32-bit systems, and 8TB on 64-bit systems.
- MySQL is customizable. Adopting the GPL license, you can modify the source code to develop your own MySQL system.
What should you know before starting this tutorial?
Before starting this tutorial, you should have basic knowledge of PHP and HTML and be able to apply them simply.
Many examples in this tutorial are related to the PHP language. Our examples are basically demonstrated using PHP.
If you don't know PHP yet, you can use this site'sPHP Tutorialto learn about that language.
Other Extensions