![](http://habrastorage.org/getpro/habr/avatars/a56/cb3/316/a56cb3316241af4241c2c49d8ba62bd2.jpg)
How to build a beautiful database schema in yEd Graph Editor
- From the sandbox
- Tutorial
I want to show you how, with the help of the now popular yEd application, which is designed to build various diagrams and schemes, you can make a complete (with all the notation) database schema.
So, for starters, we have a standard container with elements for building an ERD (entity relationship diagram). Their designations are shown in the figure.
![image](https://habrastorage.org/getpro/habr/post_images/dc2/001/0d9/dc20010d9f22bc9f5d742a5139168636.png)
A small digression, if you need to insert just text on the diagram, i.e. without any block, then the following simple steps from a comment from jaiprakash quickly solve this problem. “Select any link -> add label -> enter text -> convert to node.”
So, we pose the conditional task of constructing the following scheme.
![image](https://habrastorage.org/getpro/habr/post_images/e1a/0bd/bdb/e1a0bdbdb20b7d2788e5187ebed0dd66.png)
Create a framework of basic elements.
![image](https://habrastorage.org/getpro/habr/post_images/e83/2af/039/e832af03957200d476af7b237a21ae9c.png)
In order to add the notation of primary and foreign keys you have to contrive a little. Selecting the desired element, add a new label to it, which we will call KEY. Because It will be located under the main unit, then select it using the clamped Ctr.
![image](https://habrastorage.org/getpro/habr/post_images/9fd/847/033/9fd8470337e26658760b9613fda1c1e8.png)
![image](https://habrastorage.org/getpro/habr/post_images/ce3/acc/b56/ce3accb56cb84755e3cb9bc94e99dfdc.png)
Set its Placment (placement) by selecting Internal: top left (inside, top left), color as desired, Distance (distance from the edges) to zero, Insets (insertion in pixels) to 20 2 0 0 so that it is opposite the attribute field with a small distance, Font Family (font) set Segoe UI Symbol, because It accurately supports the necessary characters.
![image](https://habrastorage.org/getpro/habr/post_images/316/4b1/40c/3164b140cd5db7a680c2598bd779c492.png)
Symbols for copying can be found, for example, in the Windows symbol table.
![image](https://habrastorage.org/getpro/habr/post_images/a47/199/136/a4719913697118b719975ac7bbb0100a.png)
![image](https://habrastorage.org/getpro/habr/post_images/82c/ce8/3dc/82cce83dc06349b06a7ad1c8f3350bbc.png)
Do the same with the arrows.
![image](https://habrastorage.org/getpro/habr/post_images/f96/a33/6e3/f96a336e38f4920a0482aa38a5a9af67.png)
In order to combine several tables into a block, you can use Grouping.
![image](https://habrastorage.org/getpro/habr/post_images/6eb/a80/b03/6eba80b03576119ddee5b171c4ef4a61.png)
The final version of the example is as follows. Everything is clear and beautiful :)
![image](https://habrastorage.org/getpro/habr/post_images/ac0/c41/a79/ac0c41a790a0ef5a8cbd60ef3c501aa7.png)
I hope this short article will help some of the novice database designers. Thank you for your attention, I will be glad to comment.
So, for starters, we have a standard container with elements for building an ERD (entity relationship diagram). Their designations are shown in the figure.
![image](https://habrastorage.org/getpro/habr/post_images/dc2/001/0d9/dc20010d9f22bc9f5d742a5139168636.png)
A small digression, if you need to insert just text on the diagram, i.e. without any block, then the following simple steps from a comment from jaiprakash quickly solve this problem. “Select any link -> add label -> enter text -> convert to node.”
So, we pose the conditional task of constructing the following scheme.
![image](https://habrastorage.org/getpro/habr/post_images/e1a/0bd/bdb/e1a0bdbdb20b7d2788e5187ebed0dd66.png)
Create a framework of basic elements.
![image](https://habrastorage.org/getpro/habr/post_images/e83/2af/039/e832af03957200d476af7b237a21ae9c.png)
In order to add the notation of primary and foreign keys you have to contrive a little. Selecting the desired element, add a new label to it, which we will call KEY. Because It will be located under the main unit, then select it using the clamped Ctr.
![image](https://habrastorage.org/getpro/habr/post_images/9fd/847/033/9fd8470337e26658760b9613fda1c1e8.png)
![image](https://habrastorage.org/getpro/habr/post_images/ce3/acc/b56/ce3accb56cb84755e3cb9bc94e99dfdc.png)
Set its Placment (placement) by selecting Internal: top left (inside, top left), color as desired, Distance (distance from the edges) to zero, Insets (insertion in pixels) to 20 2 0 0 so that it is opposite the attribute field with a small distance, Font Family (font) set Segoe UI Symbol, because It accurately supports the necessary characters.
![image](https://habrastorage.org/getpro/habr/post_images/316/4b1/40c/3164b140cd5db7a680c2598bd779c492.png)
Symbols for copying can be found, for example, in the Windows symbol table.
![image](https://habrastorage.org/getpro/habr/post_images/a47/199/136/a4719913697118b719975ac7bbb0100a.png)
![image](https://habrastorage.org/getpro/habr/post_images/82c/ce8/3dc/82cce83dc06349b06a7ad1c8f3350bbc.png)
Do the same with the arrows.
![image](https://habrastorage.org/getpro/habr/post_images/f96/a33/6e3/f96a336e38f4920a0482aa38a5a9af67.png)
In order to combine several tables into a block, you can use Grouping.
![image](https://habrastorage.org/getpro/habr/post_images/6eb/a80/b03/6eba80b03576119ddee5b171c4ef4a61.png)
The final version of the example is as follows. Everything is clear and beautiful :)
![image](https://habrastorage.org/getpro/habr/post_images/ac0/c41/a79/ac0c41a790a0ef5a8cbd60ef3c501aa7.png)
I hope this short article will help some of the novice database designers. Thank you for your attention, I will be glad to comment.