Several tips for using powerdesigner

Source: Internet
Author: User
Tags powerdesigner

1. generate an SQL script
Database → generate Database
Select the file path to be output, that is, the file storage path, and modify the file name as needed. Click OK to generate an SQL script.

On the options tab, you can customize the selection and configuration of SQL scripts, such as canceling foreign keys and removing drop statements.

On the selection tab, you can select the tables to generate SQL scripts.
On the preview tab, You can preview the SQL script to be generated.
2. Convert all nouns into uppercase letters
Tools → model options... → naming convention → code → uppercase.

3. The table field design window displays comment to write comments.
Double-click the table to open the table Properties window → columns tab → click the second to last icon (mimize columns and filter) → select comment

4. When the field name of the table is modified, the Code does not automatically change.
Tools → general options... → dialog → uncheck name to code encoding ing

5. Conversion between different databases
Database → change current DBMS → select the target database to be converted

6. Import the SQL script to generate the corresponding database table model Diagram
File → reverse engineer → database... → modify the module name and select DBMS

Using script files → click the icon below (add files) to add an SQL script file → OK

7. The object model is generated by the physical model and the corresponding get and set methods are generated.
Tools → generate object-oriented model... → Select language → modify name and code → (selection tab → select the table for which the object model is to be generated) → OK

Double-click the class chart of a generated table to open the Properties window → select all fields → change the field visibility to private → click the add... button below → select get/Set Operations → OK
Then generate the code: language → generate Java code...

[Note: The content under the add... button in different languages is different, for example, C # is property]
6. Generate database documents
Report → generate report... → select generate RTF → modify repor namet → select Chinese → Select File storage location → OK

Powerdesigner also provides the document editing function: Report → reports... → click the new report icon → modify repor namet → select Chinese language → Report Template select full physical report
Then you can open the document editing window, but we will not detail how to edit it here. Let's take a look.
8. How to create an auto-increment primary key
Double-click the table to open the Properties window → select the P primary key check box → double-click the field set as the primary key (double-click the row header) or click the attribute icon on the top → select sequence under the open window (note that different databases are different, and SQL Server is the identity check box, if not, click the new button next to it to create a sequence.

9. How to Create a view
In the toolbar, click View> Create View> double-click View to open the attribute window. usage indicates whether the view is read-only or updatable. If we only create a general view, select the query only option.

Switch to the SQL query tab. In the text box, you can set SQL query statements for the definition view. It is best not to use * when defining the view. Instead, you should use the column names required, in this way, you can see each column in the columns of the view attribute. Click the Edit with SQL editor button in the lower-right corner to pop up the SQL editor and write SQL statements. You can also use other SQL statement generators to generate SQL statements.

10. How to create an index
Double-click a table to open the Properties window → select the indexes tab → create an index → double-click the index to open the Properties window

Select the columns tab → click the add columns icon → select the field to be indexed → OK
Here, column definition is not selected and will conflict with the primary key.

11. How to Create a stored procedure
Click the procedure button in the toolbar → create a stored procedure → double-click a stored procedure to open the Properties window → select the definition tab. In the drop-down list box, there are two options: default procedure and default function, the former is the definition process, and the latter is the attribute function. The system will create a template for the SQL statement based on the selected type → edit the Stored Procedure script.

The above is the main content of the physical model of powerdesigner. In fact, this is only a small drop in the ocean. It only involves a model. There are many other models worth learning. If we want to make it comprehensive, that blog post must be unable to accommodate and need to be serialized.
Powerdesigner is really powerful. It is also awesome to design UML with it. You should learn how to use this tool if possible, I may introduce how to use powerdesigner to design the object model UML in my blog post in the future, or if it is hard to do so, it will really be a problem. So let's look forward to it!

Supplement:
1. In the PDM model, when the relationship between two tables is established, the cascade relationship is as follows:
Double-click the association relationship between two tables. The table information window is displayed. On the "Identity" tab, the following parameters are displayed. The description is as follows: None: the parent table is modified and the child table is not affected. Restrict: Modify the parent table. If the child table exists, an error occurs. Cascade: Modify the parent table. If the child table exists, modify the table accordingly. Set NULL: Modify the parent table. If the child table exists, it is set to null. Set Default: Modify the parent table. If the child table exists, set the default value accordingly.

Several tips for using powerdesigner

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.