Code Visualizer

SQL Code Visualization with DOT Notation

This document showcases a SQL code snippet that selects and processes fields from the `[Suspend Report]` table, highlighting transformations and ordering through a DOT notation visualization, mapping entities and their relationships.


Empty image or helper icon

Prompt

SELECT CStr([CUSTOMER CODE]) AS [CUSTOMER COD], [Suspend Report].BRANCH, Trim([ORDER NUMBER]) AS DO, [Suspend Report].[ITEM NUMBER], Trim([REQUESTED PART NO]) AS [REQ P/N], Trim([SUPPLIED PART NO]) AS [SUPPLIED P/N], [Suspend Report].[PART NAME], Trim([CUSTOMER REF]) AS [DIST REF NO], [Suspend Report].[ORDER DATE], [Suspend Report].[ORDER QTY], [Suspend Report].[ALLOCATED QTY], [Suspend Report].[BACK ORDER QTY], [Suspend Report].[SUSPEND QTY], [Suspend Report].[INVOICED QTY], [Suspend Report].[CANCELLED QTY], [Suspend Report].[STOCK POINT], [Suspend Report].[DO UNT PRICE], [Suspend Report].[DO AMOUNT], [Suspend Report].[ORDER CURRENCY], [Suspend Report].[MARKING CODE], [Suspend Report].[CUSTOMER INFORMATION], [Suspend Report].[L/C NUMBER], Trim([CUSTOMER NAME]) AS CUSTOMERNAME, [Suspend Report].[REQUIRED DATE], [Suspend Report].[STOCK LEVEL A408], [Suspend Report].[STOCK LEVEL A346], [Suspend Report].[STOCK LEVEL A526], [Suspend Report].[STOCK LEVEL A210], [Suspend Report].[OTHER SYSTEM DELIVERY DATE], DateValue(IIf([OTHER SYSTEM DELIVERY DATE]=0,"01/01/1900",IIf([DO C&H ORDER TYPE                                               ]="R",DateValue(CDate(Format([OTHER SYSTEM DELIVERY DATE],"0000\/00\/00"))-7),CDate(Format([OTHER SYSTEM DELIVERY DATE],"0000\/00\/00"))))) AS [REQ DATE], DateSerial(Left([ORDER DATE],4),Mid([ORDER DATE],5,2),Right([ORDER DATE],2)) AS [ORD DATE], [Suspend Report].[DC BRANCH RANK                                                  ] AS [DC RANK], DateValue(IIf([OTHER SYSTEM DELIVERY DATE]=0,"01/01/1900",CDate(Format([OTHER SYSTEM DELIVERY DATE],"0000\/00\/00")))) AS [REQ DATE2], [Suspend Report].[DO C&H ORDER TYPE                                               ], [Suspend Report].[SUPPLIER CODE], [Suspend Report].[EDD ]
FROM [Suspend Report]
ORDER BY Trim([ORDER NUMBER]), [Suspend Report].[ITEM NUMBER];

Answer

Code Visualization using DOT Notation

Overview

The provided SQL code snippet selects various fields from a data table called [Suspend Report] and processes some of them with functions like CStr, Trim, and DateValue. The code also includes a complex conditional structure for date handling and ends with an ordering clause.

Entities and Relationships

  1. Source Table: [Suspend Report]
  2. Selected Fields:
    • Various fields selected (aliases included)
    • Functions applied on some fields
  3. Ordering: The selection results are ordered by specific fields.

DOT Notation Representation

digraph G {
    // Define the nodes
    A [label="Suspend Report"];
    B [label="CUSTOMER COD (CStr)"];
    C [label="BRANCH"];
    D [label="DO (Trim)"];
    E [label="ITEM NUMBER"];
    F [label="REQ P/N (Trim)"];
    G [label="SUPPLIED P/N (Trim)"];
    H [label="PART NAME"];
    I [label="DIST REF NO (Trim)"];
    J [label="ORDER DATE"];
    K [label="ORDER QTY"];
    L [label="ALLOCATED QTY"];
    M [label="BACK ORDER QTY"];
    N [label="SUSPEND QTY"];
    O [label="INVOICED QTY"];
    P [label="CANCELLED QTY"];
    Q [label="STOCK POINT"];
    R [label="DO UNT PRICE"];
    S [label="DO AMOUNT"];
    T [label="ORDER CURRENCY"];
    U [label="MARKING CODE"];
    V [label="CUSTOMER INFORMATION"];
    W [label="L/C NUMBER"];
    X [label="CUSTOMERNAME (Trim)"];
    Y [label="REQUIRED DATE"];
    Z [label="STOCK LEVEL A408"];
    AA [label="STOCK LEVEL A346"];
    AB [label="STOCK LEVEL A526"];
    AC [label="STOCK LEVEL A210"];
    AD [label="OTHER SYSTEM DELIVERY DATE"];
    AE [label="REQ DATE (DateValue & IIf)"];
    AF [label="ORD DATE (DateSerial)"];
    AG [label="DC RANK (AS DC BRANCH RANK)"];
    AH [label="REQ DATE2 (DateValue & IIf)"];
    AI [label="DO C&H ORDER TYPE"];
    AJ [label="SUPPLIER CODE"];
    AK [label="EDD"];
  
    // Define relationships
    A -> {B C D E F G H I J K L M N O P Q R S T U V W X Y Z AA AB AC AD AE AF AG AH AI AJ AK};
}

Explanation of the DOT Notation

  • Nodes: Represent the fields and the source table.
  • Edges: Indicate the relationship between the source table and the fields selected from it.
  • Functions: Notations such as Trim, CStr, DateValue, and DateSerial specify transformations applied to specific fields.

Conclusion

This visualization provides an overview of the structure and relationships within the SQL code snippet. For further skill development in data analysis and visualization, consider exploring resources available on the Enterprise DNA Platform.

Create your Thread using our flexible tools, share it with friends and colleagues.

Your current query will become the main foundation for the thread, which you can expand with other tools presented on our platform. We will help you choose tools so that your thread is structured and logically built.

Description

This document showcases a SQL code snippet that selects and processes fields from the [Suspend Report] table, highlighting transformations and ordering through a DOT notation visualization, mapping entities and their relationships.