Database design has a rigorous process, according to the process of making a complete database, you can save a lot of time, but also to the greatest extent with the customer's ideas fit.
Requirements Analysis phase: Analyze customer's business and data processing requirements
Summary design phase: Design The E-R model of the database to confirm the correctness and completeness of the requirement information
Detailed design phase: Application of three major paradigms to audit database structure
Code writing phase: physical implementation of the database, encoding implementation of the application
A hospital ward Computer Management Center needs the following information: Department: section name, branch address, telephone, doctor name Ward: Ward number, bed number, the department name of the Doctor: name, title, department name, age, ID number of patients: Medical record number, name, gender, diagnosis, competent physician, ward number of which, A ward can only belong to a department, a department may have multiple wards, a doctor only belong to a department, a department can have more than one doctor, a doctor can be responsible for the diagnosis and treatment of multiple patients, a patient's competent doctor only one. A patient can only stay in one ward, and a ward may accommodate multiple patients. Complete the following design: (1) the E-r Diagram (2) of the Computer Management system is designed to convert the E-r diagram into a relational schema structure.
1. If it is a 1:1 relationship: then convert the entity to a table, the primary key of any 1-side entity to the other end of the entity to do foreign keys. 2. If the relationship is 1:n: then the entity is converted into a table, the relationship is not a table, the 1-side entity's primary key to the N-side entity to do foreign keys. 3. If the relationship is m:n: convert the entity into a table, the relationship forms a table, and the primary key of the two entities is taken as the foreign key of the table, forming a composite primary key.
Design of MySQL Database