MySQL course


MySQL Is the most popular relational database management system , stay WEB Application MySQL Is the best RDBMS(Relational Database Management System: Relational database management system ) One of the applications .

In this tutorial , Will let everyone quickly master MySQL Basic knowledge of , And easy to use MySQL database .

What is a database ?

database (Database) It is organized according to the data structure 、 A warehouse for storing and managing data .

Each database has one or more different API Used to create , visit , Administration , Search and copy saved data .

We can also store data in files , But the speed of reading and writing data in files is relatively slow .

So , Now we use a relational database management system (RDBMS) To store and manage large amounts of data . The so-called relational database , It is a database based on relational model , With the help of mathematical concepts and methods such as set algebra to process the data in the database .

RDBMS Relational database management system (Relational Database Management System) Characteristics of :

  • 1. The data appears in the form of a table
  • 2. Each line has various record names
  • 3. Each column is the data field corresponding to the record name
  • 4. Many rows and columns form a form
  • 5. A number of forms database

RDBMS The term

Before we start learning MySQL Before the database , Let's first understand RDBMS Some terms of :

  • database : A database is a collection of associated tables .
  • data sheet : A table is a matrix of data . A table in a database looks like a simple spreadsheet .
  • column : A column ( Data elements ) Contains the same type of data , For example, zip code data .
  • that 's ok : a line (= Tuples , Or record ) Is a set of related data , For example, a piece of data subscribed by a user .
  • Redundancy : Store twice as much data , Redundancy reduces performance , But it improves the security of data .
  • Primary key : The primary key is unique . A data table can only contain one primary key . You can use the primary key to query data .
  • Foreign keys : Foreign keys are used to associate two tables .
  • Compound bond : Compound bond ( Key combination ) Use multiple columns as an index key , Generally used for composite indexes .
  • Indexes : Use indexes to quickly access specific information in database tables . An index is a structure that sorts the values of one or more columns in a database table . A catalogue similar to a Book .
  • Referential integrity : Referential integrity requires that nonexistent entities cannot be referenced in a relationship . And entity integrity are the integrity constraints that the relational model must meet , The purpose is to ensure the consistency of data .

MySQL It is a relational database (Relational Database Management System), This so-called " Relational " It can be understood as " form " The concept of , A relational database consists of one or more tables , A table as shown in the figure :

  • Header (header): The name of each column ;
  • column (col): A collection of data with the same data type ;
  • that 's ok (row): Each line is used to describe the specific information of a record ;
  • Worth (value): Line details , Each value must be of the same data type as the column ;
  • key (key): The value of the key is unique in the current column .

MySQL database

MySQL Is a relational database management system , By Sweden MySQL AB The company developed , At present, it belongs to Oracle company .MySQL Is an associated database management system , Associated databases store data in different tables , Instead of putting all the data in one big warehouse , This increases speed and flexibility .

  • MySQL It's open source , At present, it belongs to Oracle Its products .
  • MySQL Support large databases . Can handle large databases with tens of millions of records .
  • MySQL Use standard SQL Data language form .
  • MySQL Can run on multiple systems , And support multiple languages . These programming languages include C、C++、Python、Java、Perl、PHP、Eiffel、Ruby and Tcl etc. .
  • MySQL yes PHP There is good support ,PHP It is the most popular Web Development language .
  • MySQL Support large databases , support 5000 A data warehouse of 10000 records ,32 Bit system table files can support up to 4GB,64 The largest table file supported by the bit system is 8TB.
  • MySQL It can be customized , Adopted GPL agreement , You can modify the source code to develop your own MySQL system .

Before starting this tutorial, you should understand ?

Before starting this tutorial, you should understand PHP and HTML Basic knowledge of , And can be simply applied .

Many of the examples in this tutorial are related to PHP Language related , Our example basically adopts PHP Language to demonstrate .

If you don't know PHP, You can use the website's PHP course To understand the language .