To solve the actual problem on the computer, we need to abstract the entity model from the actual problem, and then map the entity model to the database relational table.
For example, when we are thinking about selecting courses for students, the entity model is "student" and "course ".
In this case, we can use powerdesigner to establish a conceptual model, and use graphical methods to understand and represent the relationship between two object objects. So how can we use powerdesinger to create a conceptual model?
I. Conceptual Model
- Create a conceptualdatamodel
- Create entity
- Tip: In attribute settings of the conceptual model, datatype settings can be directly set using the abbreviation in code. For example, if the data type of age is input to va64, it will be automatically completed.
- F6 zoom in and F7 zoom out settings Background: Tools-> display preferences-> General
- Window color changes background color grid: whether to display virtual vertex digoal: Show page delimiter display split line and then edit the corresponding attribute information. Note: In an object, you only need to edit the attribute information, you do not need to consider associations, foreign keys, and other relationships between entities. You can use relationship to associate objects.
- Focus on relationship:
- Entity1 and entity2 are associated with relationship in two entities, such as the wire box. The blue line in the middle is the line to the driver, which means that each vehicle must correspond to one driver, it means that each driver can drive dominant role without a car: the control relationship, who points to who, who controls who drives to the car: hook mandatory (mandatory ), that is to say, each car must correspond to a driver: It is understood that the driver is forced to the car, that is, each car must correspond to a driver to the driver: hook dependen (dependent ), that is to say, each driver must correspond to a car: It is understood that the car is dependent on the driver, and there is no car with no corresponding driver. Now, the concept model has been established.
2. Establish a physical model
Generate a physical model using a conceptual model
The two buttons generate "object-oriented model OOM" and "Physical Model PDM" respectively"
Mr Cheng physical model:
Select a database and enter a name.
Link:
Object-Oriented model:
From conceptual model to physical model creation.
Next, create a physical model independently:
Create a physical model, name it, select a database, and then use
Create Table
Create a relationship between tables
The student information table name must be larger and separated by underscores (_): student_info: course_info: each student can choose from multiple courses, and each course can be selected by multiple students: you must use the intermediate table to establish the "many-to-many" relationship student subject information table: stu_cou_info and then use the reference in the tool to drag from dependency to dependency: the student subject information table depends on the student information table and the subject information table.
Tip: whether the display can be empty: Tools-> display preferences-> table
Domain: when creating a table, if the data types of many fields are of the same type and length, you can create a domain to facilitate unified management of domains (models) in the menu bar)
Create a custom domain type:
When you select data type for a field during subsequent table creation, you can select domain to determine the type.
Click the button in the red box to display the domain and select it. Note: When domain is selected, the Data Type will no longer take effect.
Select domain to display this column.
The setting that does not conflict between the two places is: Tools-> model options-> column & domain, you can check datatype to ensure that one of the two applications is selected. When a field is added to a table, if some fields already exist in other tables, you can use
To include that field, but if the field is modified later, the field will also change.
How to Use powerdesigner-from "conceptual model" to "Physical Model"