Database
Mysql Tutorial
What does the normalization process primarily address in the logical structure of the database?
What does the normalization process primarily address in the logical structure of the database?
The normalization process is mainly to overcome the defects of insertion anomalies, deletion anomalies and high redundancy in the logical structure of the database. Database normalization allows database designers to better understand the current data structure within the organization, ultimately resulting in a series of data entities. Database standardization can effectively reduce database redundancy through the design of database tables.

Database normalization process
The standardization of relational databases is simply to of standardization.
Necessity of standardization:
According to the needs of the project, we will create corresponding database tables to complete the data in the project of storage. This has become a fixed process for doing projects, but when you actually start to deal with business needs, you will realize that your table settings are unreasonable, leading to repeated storage of data, insertion exceptions, deletion exceptions, update exceptions and other problems. At this time, it is necessary to re-plan the table, which is a waste of time, manpower and financial resources, and is very uneconomical. Therefore, standardization is very necessary, so today I will teach you how to standardize the table.
Before teaching the standardized database method, let me introduce the knowledge to you first:
Key knowledge points function dependency
##Definition of functional dependency:
The definition may be a little difficult to understand. Let me explain it briefly here: Functional dependency describes a mapping relationship between two collections. This mapping relationship is the same as a function. For example, y = x^2, here for x, one x corresponds to one y value, but there is no situation where one x corresponds to multiple y values, so it can be said that the y function depends on x. However, for For y, there is a situation where one y value corresponds to multiple x values, so x is not functionally dependent on y. This is functional dependency. Next we introduce several special functional dependencies:Suppose R(U) is a subset of the attribute set, X and Y are subsets of U, If for any possible relation r on R(U), if there cannot be two tuples in r whose attribute values on X are equal but their attribute values on Y are not equal, then it is said that the X function determines If Y or Y is functionally dependent on X, it is denoted as X->Y.
Complete functional dependency
Definition: If X-> ;Y, and for any proper subset X' of X does not exist, X'->Y, then we say that the functional dependence of X->Y belongs to complete functional dependence. A brief explanation: Function z = x y, for z: z function depends on x and y, but z does not depend solely on x or solely on y, which means that z function depends on This dependence between x and y is a complete functional dependence.Partial functional dependency:
Definition: If X->Y, but Y does not completely depend on X, then this dependence is called For partial complete dependence. That is to say: the function z = x 0y can be regarded as , that is to say, the z function depends on x and y, but z depends solely on x, then this is partial functional dependence.Transitive functional dependency:
Definition: If X->Y, Y -> Z, and not true, Y-> X is not true either. Then the Z transfer function is said to depend on X. This is relatively simple. The function group z = x^2, x = 2y can be simplified to z = 4y ^2. It is easy to see: z is a function that depends on x, x depends on y, and z ->x does not hold, this is a transfer function dependency.Key knowledge point two-----Key
Candidate key: an attribute (field) or An attribute group (multiple fields) can be completely determined by other attributes (fields) in the relational schema (table). That is to say, other attributes (fields) are completely dependent on this attribute (field) or attribute group (multiple fields).
Primary key: If there is more than one candidate key, select one of them as the primary key. The value of the attribute or attribute group selected as the primary key in each tuple (row) in the relationship schema (table) is not allowed to be repeated and the value is null.
Main attributes: The attributes in any candidate key are called primary attributes. If the candidate key is composed of multiple attributes, then each attribute in these attribute groups is a primary attribute.
Non-primary attributes: Attributes that are not included in any key are called non-primary attributes.
Foreign key: An attribute or attribute group is not a primary key in the current relational schema (table), but serves as the primary key in another relational schema (table). This attribute or attribute group is called Property groups are foreign keys.
After introducing the above basic knowledge points, let's start learning the standardization process of database tables: If you want to standardize a table, you first need a standard to measure whether the table has been standardized. This standard is----paradigm.
There are six paradigms: first normal form (1NF), second normal form (2NF), third normal form (3NF), BC normal form (BCNF), fourth normal form (4NF), and fifth normal form (5NF).
In the above six paradigms, under normal circumstances we need to standardize the table to BCNF, which is perfect. In real projects, it only needs to reach 3NF.
Next, we will focus on the first four paradigms:
First paradigm: All attributes in the relational model R are inseparable data items.
To put it simply, as long as you can create a table, the table already satisfies the first normal form. For example, the student table (student_id, course_id, student_name, age, sex, grade, sdept, sdept_director). In this table, it is obvious that the grade item is jointly determined by student_id, course_id, so these two items should be combined as Primary key.
Second normal form: On the basis of satisfying the first normal form, satisfying non-primary attributes completely depends on the primary key of R.
This requires the use of the previous content to determine whether the non-primary attributes are completely dependent on the primary key. If you are not satisfied, it will be heavy Change the structure of the table. For example, the student table (student_id, course_id, student_name, age, sex, grade, sdept_id, sdept_director) uses the combination of student_id and course_id as the primary key, but for other attributes such as name, age, and sex, they are completely dependent. Rely on the attribute student_id, so they are partially dependent on student_id and course_id as the primary key. This does not meet the definition of the second normal form, so we should take out the grade and split this large table into two small tables: student(student_id, name, age, sex, sdept_id, sdept_director), student_score(student_id, course_id , grade);
Third normal form: Remove transitive dependencies when the second normal form is satisfied.
For example: student table (student_id, student_name, age, sex, sdept, sdept_director), obviously each major determines a professional director, so the sdept_director transfer depends on the student_id, so it should be split into one The tables student (student_id, student_name, age, sex) and sdept (sdept_id, sdept_name, sdept_director) satisfy the third normal form.
BC paradigm: When satisfying the third paradigm, three more points must be met:
1. All main attributes are completely dependent on other Contains its own candidate key;
2. All non-primary attributes are completely dependent on each candidate key;
3. No attribute is completely functionally dependent on any one Group non-primary attribute.
The previous three paradigms all impose various constraints on non-primary attributes. The BC paradigm is based on them and then constrains the primary attributes to solve the partial dependence between the primary attributes. problem, and there is no problem that the main attribute completely depends on the non-primary attribute. Our student table student (student_id, student_name, age, sex), the primary key is student_id, so the main attribute is student_id. Obviously the first two are satisfied, because the student's name may be repeated, so there is no functional dependency between student_id and student_name relationship, so the student table satisfies BC normal form.
The above is the normalization process of the database
Related recommendations: "mysql tutorial"
The above is the detailed content of What does the normalization process primarily address in the logical structure of the database?. For more information, please follow other related articles on the PHP Chinese website!
Hot AI Tools
Undress AI Tool
Undress images for free
Undresser.AI Undress
AI-powered app for creating realistic nude photos
AI Clothes Remover
Online AI tool for removing clothes from photos.
Clothoff.io
AI clothes remover
Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!
Hot Article
Hot Tools
Notepad++7.3.1
Easy-to-use and free code editor
SublimeText3 Chinese version
Chinese version, very easy to use
Zend Studio 13.0.1
Powerful PHP integrated development environment
Dreamweaver CS6
Visual web development tools
SublimeText3 Mac version
God-level code editing software (SublimeText3)
iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos
Jul 18, 2024 am 05:48 AM
Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps
How to save JSON data to database in Golang?
Jun 06, 2024 am 11:24 AM
JSON data can be saved into a MySQL database by using the gjson library or the json.Unmarshal function. The gjson library provides convenience methods to parse JSON fields, and the json.Unmarshal function requires a target type pointer to unmarshal JSON data. Both methods require preparing SQL statements and performing insert operations to persist the data into the database.
MySQL: Simple Concepts for Easy Learning
Apr 10, 2025 am 09:29 AM
MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.
Oracle's Role in the Business World
Apr 23, 2025 am 12:01 AM
Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.
MySQL: An Introduction to the World's Most Popular Database
Apr 12, 2025 am 12:18 AM
MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.
MySQL vs. Other Databases: Comparing the Options
Apr 15, 2025 am 12:08 AM
MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.
MySQL: A Beginner-Friendly Approach to Data Storage
Apr 17, 2025 am 12:21 AM
MySQL is suitable for beginners because it is easy to use and powerful. 1.MySQL is a relational database, and uses SQL for CRUD operations. 2. It is simple to install and requires the root user password to be configured. 3. Use INSERT, UPDATE, DELETE, and SELECT to perform data operations. 4. ORDERBY, WHERE and JOIN can be used for complex queries. 5. Debugging requires checking the syntax and use EXPLAIN to analyze the query. 6. Optimization suggestions include using indexes, choosing the right data type and good programming habits.
Why Use MySQL? Benefits and Advantages
Apr 12, 2025 am 12:17 AM
MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.


