Archive for the ‘database designer’ Category

GUI dbForge Studio for MySQL, v4.50.311 Released

Октябрь 27th, 2010

Changes (as compared to 4.50.308) include:
Bug fixes:
* Removed spaces in the integer and float format in Data Export wizard (T23612)
* Fixed NullReferenceException on saving a database project with opened table editors (T23519)
* Fixed NullReferenceException on deleting a table from a database with an opened inactive editor (T56081)
* Fixed NullReferenceException on auto hiding a tool window (T56033)
* Added possibility to edit a definer for triggers in the trigger editor (T23357)
* Fixed problem with BINARY(16) column type on selecting its data to the Data Editor (T23292)
* Fixed problem with empty gray windows after editing a table in the modal editor from Database Designer (T23164, T23018)
* Fixed link on the first page in the product tour (55629)
* Fixed syntax checking for some constructions in CREATE TABLE statements (55161)
* Fixed lost connection on the data comparing (T22521)
* Impossibility to disable Code Completion in the Express edition was fixed (54932)
* Files in database projects are saved with a relative path now (54378)

Downloads: http://www.devart.com/dbforge/mysql/studio/download.html
Ordering: http://www.devart.com/dbforge/mysql/studio/ordering.html


PlanetMySQL Voting: Vote UP / Vote DOWN

GUI dbForge Studio for MySQL, v4.50.311 Released

Октябрь 27th, 2010

Changes (as compared to 4.50.308) include:
Bug fixes:
* Removed spaces in the integer and float format in Data Export wizard (T23612)
* Fixed NullReferenceException on saving a database project with opened table editors (T23519)
* Fixed NullReferenceException on deleting a table from a database with an opened inactive editor (T56081)
* Fixed NullReferenceException on auto hiding a tool window (T56033)
* Added possibility to edit a definer for triggers in the trigger editor (T23357)
* Fixed problem with BINARY(16) column type on selecting its data to the Data Editor (T23292)
* Fixed problem with empty gray windows after editing a table in the modal editor from Database Designer (T23164, T23018)
* Fixed link on the first page in the product tour (55629)
* Fixed syntax checking for some constructions in CREATE TABLE statements (55161)
* Fixed lost connection on the data comparing (T22521)
* Impossibility to disable Code Completion in the Express edition was fixed (54932)
* Files in database projects are saved with a relative path now (54378)

Downloads: http://www.devart.com/dbforge/mysql/studio/download.html
Ordering: http://www.devart.com/dbforge/mysql/studio/ordering.html


PlanetMySQL Voting: Vote UP / Vote DOWN

How To: Create a Database Diagram Using a Sketch Image

Октябрь 5th, 2010

Often we make some sketches of the database we plan to create on a blackboard or a sheet of paper before we actually design its structure on computer. After that we discuss the entities we’ve got, normalize them and repeat these actions several times. As a result we get a completely approved database structure in the form of an image file in the project documentation.

Question:
How to create a database diagram basing on the image available?

Let’s try to do this using Database Designer of dbForge Studio for MySQL.

Let us suppose that you have a sketch of the future database:

Database Structure

Database Structure

To place this picture onto an empty diagram you should create an empty document, for example, Diagram1.dbd by pressing New Database Diagram on the Standard toolbar. After that you should press the New Image button on the Database Diagram toolbar. The mouse pointer will change to an icon with a picture. Click on any part of the diagram. In the Open dialog window that appeared select the image with the diagram structure sketch.

Open New Image

Database Designer: Open New Image

Now as you see the database sketch you can recreate the database from it. Let’s create the necessary tables with Primary Key and indexes one by one. For example, to create the Sessions table press the New Table button on the Database Diagram toolbar. The mouse pointer should change to an icon with a table. Click on any part of the diagram. A window for editing the Table1 table should appear.

Create New Table

Database Designer: Create New Table

Using the database editor window you should do the following:

  • On the General tab edit the table name; add a key column (in this column you should edit its name, datatype, and set the Primary option); add all other columns (uncheck the additional Allow nulls(*) option)
  • On the Indexes tab let’s create indexes for all key columns and uncheck the Unique option

As a result we’ve got a new entity on the diagram – the Sessions table.

Design New Table

Database Designer: Design New Table

Move the table on the diagram not far from its presentation on the sketch. Then create the next table, for example, Hits, in the same way and move it not far from its presentation on the sketch.
Now we can add a relation between the Hits and Sessions tables. To do this, you should:

  • press the New Relation button on the Database Diagram toolbar. The mouse pointer should change to an icon with an arrow. Then click the Hits table, and, without releasing the mouse button, drag the cursor to any part of the Sessions table and release the mouse button(**).
  • in the Foreign Key Properties window that appeared select the SessionID column from the “Table Columns” columns list and press the [→] button. The SessionID column was moved to the “Constraints Columns” column list. Save these changes by pressing OK.
Create New Relation

Database Designer: Create New Relation

As a result, we’ve bound two tables – “Hits” and “Sessions” using the foreign key “hits_FK”.

Dispalay Relation

Database Designer: Display Relation

Now we should repeat the same operations as creating and designing tables, creating indexes and relations between tables.
An important part of the database design process is logical division of database objects into groups. Database Designer available in dbForge Studio for MySQL has a special Container component for this purpose.
To create a new container and move the necessary objects into it you should:

  • Press the New Container button on the Database Diagram toolbar. The mouse pointer should change to an icon with three squares. Click on an empty place on the diagram. A container with the Group1 name appeared. Let’s change the container name;
  • Select the tables you want to move to the container. For example, let’s select Users, Registrars, Products, and OrderLinks tables;
  • Move the selected tables onto the container;
New Container

Database Designer: New Container

And the final step in the process of database creation using a sketch is the optimization of database objects location on the diagram. The algorithm used by Layout Diagram is designed so that the program redraws the relations between tables so that they would not intersect each other. This allows to save space on the diagram and makes it readable.

Layout Diagram

Database Designer: Layout Diagram

As a result of the actions described above we’ve created a database using a sketch without switching over to other applications displaying the image of the diagram using Alt+Tab or printing the sketch owing to the unique functionality of dbForge Studio for MySQL.

(*) On the diagram, columns with the Not Null property enabled are displayed in bold (for example, the HitDate column of the SpiderHits table) unlike other columns (for example, the HitUrl column of the SpiderHits table).
(**) To create Foreign Key between tables both these tables should have been created with Engine=InnoDB.

You can download a free 30-day evaluation of dbForge Studio for MySQL.


PlanetMySQL Voting: Vote UP / Vote DOWN

How to: Create MySQL Database in One Shot

Июль 19th, 2010

There is a lot of instruments that allow database developers avoid monotonous and error prone manual writing of scripts for tables creation. But to have a complete picture while creating a database it’s necessary not only to speed up the process of database objects creation, but also to visualize relations between them. dbForge Studio for MySQL offers a perfect tool for such purpose – Database Designer.

Let’s create the sample demobase database visually.

Task:

Create a database that would contain information about the salary of employees of different company departments.

Database Sketch
Database Sketch

Solution:

Let’s start with database normalization. In the result we will get three tables:

Database Sketch after Normalization

Database Sketch after Normalization

Now it’s time to use the visual tool for designing databases – Database Designer.
But before let’s set a connection to MySQL server

Creating a new connection

Creating a new connection

and create an empty salary_db database:

Creating a new database

Creating a new database

Now let’s create an empty database diagram file:

Creating a new database diagram file

Creating a new database diagram file

Press the New Table button on the toolbar:

Creating a new table

Creating a new table

Let’s specify the table name and database in the visual table editor that appeared. After this let’s create a column:

Creating a new column

Creating a new column

and fill its parameters:

Entering column properties

Entering column properties

After this let’s create all remaining columns in the same way, and after we’ve finished let’s click OK to save our first table.
Let’s create the remaining EMP and DEPT tables. Tables can be created in any order -the order does not have any influence.
Now let’s ensure that our database has referential integrity. To do this, let’s press the NEW RELATION button on the toolbar.
After performing this action the mouse pointer should change. Let’s click the DeptNo column of the EMP table and drag the relation to the DeptNo column of the DEPT table.
In the Foreign Key Properties that appeared press OK.

Creating a new relation

Creating a new relation

The result of these actions is that there is a relation between the tables now. Let’s add a relation between the SAL and EMP tables.
To do this, let’s drag a relation from the EmpNo column of the SAL table to the column with the same name of the EMP table. Note, that it is not necessary to press the New Relation button once more.
Now let’s arrange the tables of the created database for better perception. To do this, call the popup menu of the database diagram and select the Layout Diagram option.
And here is the result:

Database Diagram

Database Diagram

Now let’s generate and save the script of the created database for further usage.
To do this, select all tables and click Generate Schema Script in the popup menu.

Generate Schema Script

Generate Schema Script

And here is the result:

Database Script

Database Script

Conclusion:
In the Database Designer tool you see the database you are creating in the form of a database diagram. Such approach allows you to create databases of any complexity visually and save the script of the created database for future use.
This article gives a step-by-step instruction for visual database creation.


PlanetMySQL Voting: Vote UP / Vote DOWN