5

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?

Christophe
  • 68,716
  • 7
  • 72
  • 138
Batman K
  • 71
  • 5
  • 1
    Sure you can show tables as (stereotyped) classes with (stereotyped) attributes. But why UML? You could as well use ERD. OR -- Powerpoint :-/ – qwerty_so Feb 06 '21 at 10:52
  • Thank you for your answer. I will take a look about your solution. I thought the best way to present that is to do it with an uml diagram. But if there is another solution it would be great! – Batman K Feb 06 '21 at 10:55
  • Venn Diagrams seem to work too. – MatBailie Feb 06 '21 at 11:07
  • 1
    If you provide: - an example of table - an example of query - preferably your attempt so far the question would be much more valuable (and easier to answer) – Ister Feb 07 '21 at 11:38

1 Answers1

6

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:

Christophe
  • 68,716
  • 7
  • 72
  • 138
  • Thank you for this answer! I don't thnik class diagram or object diagram can help me to explain my queries, because I need to explain the joins, the loops... and I can not do it with such diagrams, may be the activity diagram is the most appropriate one. – Batman K Feb 06 '21 at 13:27
  • 1
    Thanks for feedback. In principle, each join separately is best documented in the class diagram (since the join is about relation, and the associations document such relations). If it is a join that does not use the primary keys/foreign keys, you may precede the name of the association with a `/` to express that it's a derived association. But for loops, or performing several joins in different orders, etc... activity diagram can help. Apparently there's even a tool to automate diagramming of PL/SQL. I don't know what it's worth: https://umlcode.com (Screenshot is not most convincing) – Christophe Feb 07 '21 at 12:36
  • 1
    @BatmanK I've added a couple of resources, that show how class diagram can be used to document joins and views, and even clarify how some PL/SQL triggers could be highlighted in a class diagram. – Christophe Feb 07 '21 at 13:04
  • Many thanks, I will take a look at the links – Batman K Feb 08 '21 at 18:06