The contents of this section pass
I. Introduction of the database 1. What is a database?
A database is a warehouse that organizes, stores, and manages data according to its structure, and each database has one or more different APIs (application programming Interface, application programming interfaces) for creating, accessing, Managing, Search for and copy the saved data.
2. What is a database system?
A database system is a system that consists of a database and its management software.
3. The Mainstream relational database
The so-called relational database is a database based on the relational model, which uses mathematical concepts and methods such as set algebra to process data in the database.
The RDBMS is the feature of the relational database management system (relational Management Systems):
- The data appears in tabular form
- Various record names per behavior
- The data field corresponding to the record name for each column
- A number of rows and columns form a single sheet
- A number of forms form database
According to statistics, in the newly developed DBMS system, the relational database management system has accounted for 90%. The mainstream relational database management system is: Oracle,db2,sql server,sybase,access,mysql.
4.RDBMS terminology
- database: The database is a collection of some associated tables.
- data table: a table is a matrix of data. Tables in a database look like a simple spreadsheet.
- columns: a column (the data element) contains the same data, such as the postal code.
- row: a row (= tuple, or record) is a set of related data, such as a user's subscribed data.
- Redundancy : stores twice times the data, redundancy can make the system faster. (The higher the degree of normalization of a table, the more the relationship between the table and the tables may often require a connection query between multiple tables, and a connection operation can slow down the query.) For example, the student's information is stored in the student table, and the faculty information is stored in the Department table. An association relationship is established with the Department table by using the dept_id field in the student table. If you want to query the name of a student's department, you must find the student's department number (dept_id) from the student table, and then department find the name of the department based on that number. If you often need to do this, the connection query will waste a lot of time. You can therefore add a redundant field, Dept_name, to the student table, which is used to store the names of the students ' faculties. This will not have to be connected every time. )
- PRIMARY KEY : The primary key is unique. Only one primary key can be included in a data table. You can use the primary key to query the data.
- FOREIGN Key: If the public keyword is the primary key in a relationship, then this common keyword is called the foreign key of the other relationship. Thus, the foreign key represents the correlation between the two relationships. A table with a foreign key of another relationship as the primary key is called the primary table, and a table with a key in it is called the primary table from the table. A foreign key, also known as a foreign keyword, is used to correlate two tables.
- Composite key : Composite key (key combination) Multiple columns are used as an index key, and are typically applied to composite indexes.
- index: use an index to quickly access specific information in a database table. An index is a structure that sorts the values of one or more columns in a database table, similar to a catalog of books.
- referential integrity: referential integrity requires that references to non-existent entities are not allowed in the relationship. and entity integrity are the integrity constraints that the relational model must satisfy in order to ensure the consistency of the data.
Second, MySQL database
MySQL is the most popular relational database management system, and in Web applications MySQL is one of the best RDBMS (relational database Management system: relational databases Management systems) application software. Developed by the Swedish MySQL AB company, currently owned by Oracle Corporation. MySQL is an associated database management system that keeps data in separate tables rather than putting all of the data in a large warehouse, which increases speed and increases flexibility.
- MySQL is open source and does not incur additional costs.
- MySQL supports a large database. You can handle large databases that have thousands records.
- MySQL uses the standard SQL data language form.
- MySQL can be allowed on multiple systems and is supported in multiple languages. These programming languages include C, C + +, Python, Java, Perl, PHP, Eiffel, Ruby, and Tcl.
- MySQL has good support for PHP, which is currently the most popular web development language.
- MySQL support large database, support 50 million records of Data Warehouse, 32-bit system table file maximum support 4gb,64 bit system to support the largest table file is 8TB.
- MySQL can be customized, using the GPL protocol, you can modify the source code to develop their own MySQL system.
third, MySQL download and installation
The following is the download and configuration installation steps for MySQL free installation under WIN10 system:
- Go to the download area of the MySQL website (https://www.mysql.com/downloads/) and select:
- After clicking Enter, select:
- According to the operating system, select 32-bit/64-bit, enter the download interface, click "No Thanks, just start my download", skip the account Registration link:
- Unzip the installation to the specified path
- Add to environment variable
My Computer >> advanced system Settings Properties >> advanced >> Environment Variables >>Path>> New >> Add the Bin folder path under the installation directory
- Create a new My.ini configuration file under the installation directory
Python development "Part X": First knowledge of MySQL