Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Explain SQL query using UML diagram? [closed]

I have to present some complex queries and PL/SQL codes to people who don't know anything about my project. I need to explain how tables are connected, how conditions are affecting the outcome, joins, loops, etc.

Is there a way to document this SQL and PL/SQL logic using UML diagrams?

like image 839
Batman K Avatar asked Feb 06 '21 10:02

Batman K


People also ask

What is UML in SQL?

Unified Modeling Language (UML) plays a big role in software development, but also in non-software systems throughout many industries, as it's a way to visually show the behavior and structure of a system or a process.

What is query in UML?

In UML models, you can create a topic diagram to view the relationships between model elements by defining the parameters of a query. In the query, you can specify which elements or relationships to display in the diagram. Customizing queries for existing topic diagrams.

How do you explain UML diagrams?

Class diagrams are the most common diagrams used in UML. Class diagram consists of classes, interfaces, associations, and collaboration. Class diagrams basically represent the object-oriented view of a system, which is static in nature. Active class is used in a class diagram to represent the concurrency of the system.

What is database diagram in UML?

The UML Data Model Profile. The Data Model Profile is a UML extension to support the modelling of relational databases in UML. It includes custom extensions for such things as tables, data base schema, table keys, triggers and constraints.


1 Answers

Your question is very broad. Nevertheless some hints:

  • Indeed, you can explain the data structure with class diagram. This allows people to understand how the data is related/connected. Moreover, it will be very familiar if your audience is object oriented developer.
  • You can explain some specific scenarios with example data, using object diagrams that use the above mentioned classes.
  • If the PL/SQL code is very complex, you may use activity diagrams to give a visual overview of the processing logic. Interestingly, activity diagrams also support object flows, which allows to relate the activities to your class model. However, avoid to go into a detailed retranscription (control flow statement by statement): activity diagrams are not meant for visual programming, and it would be counter productive in view of the visual complexity.

If you want to know more:

  • an interesting introductory reference about mapping UML associations with SQL joins
  • another SO answer on using class models to document data models, including SQL. There's a link to a nice step by step tutorial for UML->SQL.
  • a short explanation for reverse engineering for SQL-> UML
  • great article from Scott Ambler. It explains that even (PL/SQL DML) triggers can be documented in a class diagram, and it provides a ready to use UML profile that allows to use UML stereotypes to highlight some database constructs;
like image 68
Christophe Avatar answered Oct 16 '22 10:10

Christophe