About this article

In this article, you use LucidChart to generate the Structured Query Language (SQL) commands for your database.

This post is the fifth on a series exploring the subject of relational databases for the full-stack developer.

For quick access, here is the list of the articles on the topic:

Introduction

In the last article, we applied normalization techniques to our database to obtain a design meeting the third normal form (3NF). We also implemented those design changes in our entity-relationship diagram in LucidChart.

In this article, you will generate the SQL commands for implementing your database in PostgreSQL, directly from LucidChart. This article is a short one since you already completed most of the hard work by creating a normalized database design. Let’s get to it.

Open your entity-relationship diagram

Go to LucidChart an open the document containing the ERD you completed in the last article.

LucidChart window with open entity-relationship diagram document

LucidChart window with open entity-relationship diagram document

Export to SQL

Look for the Entity Relationship section in the toolbox on the left of the screen and click on Export.

Entity Relationship toolbox

Entity Relationship toolbox

An Export to SQL window will open.

Export to SQL window

Export to SQL window

Select a SQL syntax. In your case, you will be implementing this database in PostgreSQL in the following articles, so select PostgreSQL.

Export to SQL window with PostgreSQL syntax selected

Export to SQL window with PostgreSQL syntax selected

The resulting SQL should look like this:

SQL commands generated by LucidChart from the Atelier-M ERD

Click on Copy to Clipboard and paste in a text editor. Save the file. You will be using it in the next article.

That’s it! Click on Done to close the Export to SQL window.

Conclusion

In this article, you learned how to generate the SQL commands for creating all your database tables, with keys and constraints, with a few clicks using LucidChart.

In the next article, you will deploy an instance of PostgreSQL and create your database in it.

References

You may also like:

Show CommentsClose Comments

Questions? Comments? Leave a reply to start a conversation...

Discover more from Wander In Dev

Subscribe now to keep reading and get access to the full archive.

Continue reading