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 basic knowledge of MySQL and easily use the MySQL database.
Online testing tools:https://www.jyshare.com/front-end/7768/。
What is a database?
A database (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 replicating the saved data.
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. The 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 features:
- 1. Data appears in the form of tables
- 2. Each row is a name for various records
- 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 the MySQL database, let us first understand some RDBMS terminology:
- Database:A database is a collection of related tables.
- 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 record of user subscription.
- Redundancy: Storing twice the data; redundancy reduces performance but improves data security.
- Primary key: The 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 associate 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 must not reference non-existent entities. Together with entity integrity, it is an integrity constraint that the relational model must satisfy, aiming to ensure data consistency.
MySQL is a relational database management system (RDBMS). This "relational" concept can be understood as the concept of "tables". A relational database consists of one or several tables, as shown in the figure below:

- Header: the name of each column;
- Column (col): a collection of data with the same data type;
- Row: each row is used to describe the specific information of a record;
- Value: specific information of a row; each value must be the same as the data type of its column;
- Key: The value of a key is unique within the current column.
MySQL Database
MySQL is a relational database management system developed by the Swedish company MySQL AB and is currently owned by Oracle Corporation. MySQL is a relational database management system. A relational database stores 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 form.
- 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 very suitable for Web program development.
- MySQL supports large databases, supporting data warehouses with 50 million records. On 32-bit systems, the maximum table file size is 4GB; on 64-bit systems, the maximum table file size is 8TB.
- MySQL is customizable and uses 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 PHP. Our examples are basically demonstrated using the PHP language.
If you don't know PHP yet, you can use this site'sPHP Tutorialto learn about the language.
Other extensions