Introduction to MySQL database
The MySQL database, referred to as MySQL, is a data management system developed by the Swedish MySQL AB company and widely used. The MySQL database is popular because of its small size, fast speed, and low total cost of ownership. Now, MySQL is owned by Oracle, the world's most famous database company.
The application of MySQL in domestic enterprises includes: Baidu, Alibaba, Tencent, Sina, Sohu, NetEase and other enterprises, all of which are using MySQL database.
MySQL is an open source relational database management system (RDBMS). The MySQL database system uses the most commonly used database management language - Structured Query Language (SQL) for database management.
Since MySQL is open source, anyone can download it under the GPL license and modify it according to personalized needs. MySQL has attracted much attention because of its speed, reliability and adaptability. Most people agree that MySQL is the best choice for managing content without transactional processing.
PHP is closely integrated with many databases. Because, PHP and MySQL are both open source and free. Therefore, PHP has always had good support for databases such as MySQL.
When we first learn PHP, we usually put the data in the MySQL database. Therefore, PHP programmers must learn courses for MySQL.
Many friends took many unnecessary detours in the early stages of learning MySQL, learned a lot of knowledge points that they did not need to master, and wasted a lot of valuable learning time.
When you first learn MySQL, you don’t need to learn the MySQL database and learn the level of a DBA (database administrator).
After writing code for two years. Many friends will encounter a bottleneck period. What strikes me the most is:
The most common things written in business code are addition, deletion, modification, and query.
In order to help you learn and get started quickly, I will help you summarize the most essential dry information. This chapter can be said to be a book: "Quick Start to the Essence of MySQL".
As long as you learn these contents, you will get started with mysql!
Learn to add, delete, modify, and check. I’m not afraid of writing business!
The purpose of database
When many friends first started learning databases, it was difficult to understand the role of databases. It’s unclear what relationship the database has to our real life and virtual life.
We use this chapter to speed up beginners' understanding of databases and database systems.
Nowadays, everything we see that is related to daily life and needs to be recorded is basically placed in the database:
1. The ID card information is placed in the system of the Ministry of Public Security
2. Bank card balances, transaction records, and transfer information
3. Hotel booking information (all databases have been stolen and information leaked in some way)
4. Online ticket purchase records for airplanes, trains, and automobiles
5. Various websites, QQ, online shopping, post bars, favorite music, and movie collection information
6. Mobile phone records , balance, bus card balance, water bill, electricity bill, lottery purchase record
7. Game equipment, level, magic power, strength, attack ability and other information
8. US aircraft carriers are also using mysql database to manage aircraft carrier related information
... ...Wait
Everything in our lives is recorded in the database. You can think about how important the database is!
In the 21st century, what will happen to the world if humans do not have databases?
Five basic units of database
1. Database server
2. Database
3. Data table
4. Data Field
5. Data row
We will now explain the five basic units above:
1. Database server. Refers to a computer used to run database services. In small and medium-sized enterprises, it is usually one unit. When the amount of data storage and calculation is very large, multiple units can exist. Multiple database servers work together to store or compute. Since data security is very important, we often back up the data in the database server.
2. Database. There can be multiple databases in a database server. Mainly used for classification. We can build traffic information databases, game databases, hotel reservation databases... Mainly used to divide data for different purposes into large blocks according to business.
3. Data table. For example in the game database. According to this game, it is divided into different data tables. Specifically used to distinguish different data in the game. For example: user data (user, password); character data; all equipment and equipment information; user's recharge information; medicine, magic potion information... etc.
4. Data fields, also called data List. It is the columns in the tables we see every day. In the table, we will split a user table into columns. As shown below (Table 1): user number, user name, gender, and age are fields. In a real database, the data fields need to be changed to English and written as: id, username, sex, and age.
5. Data row. The real data exists in each table row. Fields (columns) divide the format in which a table should store data. And rows are real data. Each row needs to follow the specifications and requirements of the data fields (columns) to store data.