Basic mysql knowledge
1. Why databases are used: (1) reducing storage data redundancy (2) higher data consistency (3) shared storage data (4) the standards that can be followed by databases (5), the ease of maintaining data integrity (6), and the ability to achieve data security 2. Many different data models have emerged in the history of database development, including hierarchical model, mesh model, relational model and Object Model 3. Basic concepts of Relational Database: relational database models regard the world as composed of entities and relationships. Entities may be tangible or intangible, specific or abstract, with or without life. Databases created using Relational models are called Relational databases ). A table is the core unit of a relational database. It stores data. For a relational database, there are three basic relational types of association between tables: one-to-one relationship, one-to-multiple relationship and many-to-many relationship. 4. Data Type: (1) Integer Data Type TINYINT: the data storage range is from 0 to 255. Each data type occupies 1 byte of storage space SMALLINT: the data storage range is-2 ^ 15 to 2 ^ 15-1. Each data type occupies two sub-sections of storage space. INT: data is stored in the range of-2 ^ 31 to 2 ^ 31-1. Each type of data occupies 4 bytes of storage space BIGINT: data storage ranges from-2 ^ 63 to 2 ^ 63-1. Each type of data occupies 8 bytes of storage space. (2) floating point data type: REAL: Can Be precise to 7th decimal places, its range is-3.1-40E-38 to 3.40E + 38. Each data type occupies 4 bytes of storage space FLOAT: It can be precise to 15th decimal places, and each FLOAT data occupies 8 bytes of storage space. DECIMAL: Provides the actual storage space required for decimals, such as decimal (), which indicates a 15-digit number, with an integer of 10 digits and a DECIMAL of 5 digits. (3) string type: CHAR: Data with a fixed length character. The maximum length is 8 KB. VARCHAR: variable-length data with a length of no more than 8 KB. This type has no initial length value. You must specify the length in the format of VARCHAR (X). X indicates the maximum number of characters allowed. TEXT: ASCII data larger than 8 KB can be stored as text data. (4) Date and Time data type: DATETIME: used to store the combination of date and time.