Tools:
SybasePowerdesigner 12.5
Microsoft SQL Server 2005
Step 1: Conceptual Data Model
OpenPowerdesignerSoftware, design"Conceptual Data Model"(Conceptual Data Model)It is usually used in the outline design stage.
Design table structure
Note:If the palette (Tool panel) is not displayed, You can choose --> right-click --> select "palette" (check) in the toolbar)
The design results are as follows:
In design attributes(Field)Three letters(M,P,D)Respectively:
M: Empty or not;(√ Indicates that it cannot be blank)
P: Whether it is a primary key;
D: Whether it is displayed in the view of the software;
Note the following when adding a "relationship" relationship:
1. Among all object objects,The name of an attribute cannot be repeated.
2,
When adding reference integrity, the foreign key table does not need to add the primary key field of the primary key table as the foreign key. Because when adding a "relationship" Relationship
And then convert it to the physical model,The foreign key table automatically adds the foreign key field column.
3. When adding a "relationship" relationship,The starting object is a primary key table by default, and the ending object is a foreign key table by default..Of course, it can be changed in "relationship.
Step 2: Physical Data Model
Set"Conceptual Data Model"To"Physical Data Model"(Physical Data Model), Equivalent to converting from "Outline Design" to "Detailed Settings"
", That is, the specific implementation of tables and relationships.
Select"Tools"-->"Generate physical data model....
Then selectSQL Server 2005Database management software:
After you click "OK ",
Should"SQL Server 2005"Database tables, attributes, and relationships.
Add constraints to powerdesigner
1> View or set attributes (fields) related constraints
2> set"ID column"(Automatic growth)
3> set"
Default Value "
4> set"
Check Constraints "
5> Settings
Unique Index
The differences between the conceptual data model and the physical data model are as follows:
1> in the conceptual model, do not add table-related constraints. You should add table-related constraints to the physical model;
2> the "Database" menu item is displayed only in the physical model. And only in "Database"
The "database generation" option is available in the menu item (used to generate SQL statements );
Step 3:SQL Server 2005Manually create a database
For exampleSQL Server 2005Manually create a database"Students.
Step 4:ODBCConfiguring user data sources
For example, in the user data source, add the"Students.
Step 5:SQL Server 2005Automatically create table structure
First: according to the "Physical Data Model"(Physical Data Model)Automatically create the correspondingSQLStatement:
Second, execute the createdSQLStatement file to automatically create a data table structureSQL Server 2005Database:
After completing the above steps, refreshSQL Server 2005Data, you will see the relevant table structure you created.
Of course, the above two stepsThis can be done together:
As long asDatabase"-->"Database generation", Select"Direct Generation:
In this way, usePowerdesignerDesignSQL ServerThe basic steps of the database are all completed!