{"id":2093,"date":"2022-05-25T00:33:24","date_gmt":"2022-05-25T05:33:24","guid":{"rendered":"https:\/\/www.dpriver.com\/blog\/?p=2093"},"modified":"2022-05-25T00:38:03","modified_gmt":"2022-05-25T05:38:03","slug":"where-group-by-clause-in-gudu-sqlflow-indirect-data-flow","status":"publish","type":"post","link":"https:\/\/www.dpriver.com\/blog\/2022\/05\/where-group-by-clause-in-gudu-sqlflow-indirect-data-flow\/","title":{"rendered":"Introduction to where-group-by clause in Gudu SQLFlow indirect data flow"},"content":{"rendered":"

In this article, we will introduce where-group-by clauses in Gudu SQLFlow<\/a><\/strong> indirect data flow.<\/p>\n

### 1. column in the where clause<\/h3>\n

Some columns in the source table in the WHERE clause do not affect the target columns, but are critical to the selected rowset, so they should be preserved for impact analysis and indirectly provide the data flow to the target table.<\/p>\n

Take the following SQL as an example:<\/p>\n

SELECT a.empName \u201ceName\u201d FROM scott.emp a Where sal > 1000<\/p>\n

The total number of rows in the select list is affected by the value of the sal column in the where clause, and we establish an indirect data flow for this relationship:<\/p>\n

scott.emp.sal -> indirect -> RS-1.RelationRows<\/p>\n

The data flow is as shown in the figure:<\/p>\n

<\/p>\n

### 2. COUNT()<\/h3>\n

The COUNT() function is an aggregate function that counts the total number of rows for a relationship.<\/p>\n

#### 2.1 where clause does not contain group by<\/h4>\n

Example SQL: SELECT COUNT() num_emp FROM scott.emp where city=1<\/p>\n

In the above SQL, two indirect data flows will be created because the value of COUNT() is affected by the city column in the where clause and the total row count of the scott.emp table.<\/p>\n

<\/p>\n

The data flow is shown in the figure\uff1a<\/p>\n

<\/p>\n

#### 2.2 where clause contains group by<\/h4>\n

<\/p>\n

As you can see, in addition to the two indirect data flows created in the preceding SQL, a third indirect data flow was created using deptno in the GROUPBY clause.<\/p>\n

<\/p>\n

<\/p>\n

### 3. Other aggregate functions<\/h3>\n

Other aggregate functions like SUM() work slightly differently than the COUNT() function when creating indirect data flows.<\/p>\n

#### 3.1 where clause contains group by<\/h4>\n

<\/p>\n

Aggregate functions such as SUM() compute values \u200b\u200bbased on the recordset determined by the columns used in the group by clause, so the deptno column in the group by clause is used to create an indirect data flow to the SUM() function.<\/p>\n

An indirect data flow is created from deptno to SUM().<\/p>\n

<\/p>\n

If a group by clause is present, the RelationRows pseudo-column will not be used to create indirect data flows.<\/p>\n

<\/p>\n

#### 3.2 where clause does not contain group by<\/h4>\n

<\/p>\n

The above SQL means that the entire recordset of the table will be used to calculate the value of the SUM() function.<\/p>\n

Therefore, two indirect data flows will be created as follows:<\/p>\n

<\/p>\n

<\/p>\n

### Conclusion<\/h3>\n

Thank you for reading our article and we hope it can help you to have a better understanding of\u00a0where-group-by clause in Gudu SQLFlow<\/strong> indirect data flow. If you want to learn more about Gudu SQLFlow, we would like to advise you to visit their offical website for more information.<\/p>\n

As one of the best data lineage tools<\/a><\/strong> available on the market today, Gudu SQLFlow can not only analyze SQL script files, obtain data lineage<\/a><\/strong>, and perform visual display, but also allow users to provide data lineage in CSV format and perform visual display. Thanks again!<\/p>\n

\n","protected":false},"excerpt":{"rendered":"

In this article, we will introduce where-group-by clauses in Gudu SQLFlow indirect data flow. 1. column in the where clause Some columns in the source table in the WHERE clause do not affect the target columns, but are critical to the selected rowset, so they should be preserved for impact analysis and indirectly provide the data flow to the target table. Take the following SQL as an example: SELECT a.empName \u201ceName\u201d FROM scott.emp a Where sal > 1000 The total number of rows in the select list is affected by the value of the sal column in the where clause,\u2026<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[25,8,10],"tags":[42,26,38,27],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":5}},"yoast_head":"\nIntroduction to where-group-by clause in Gudu SQLFlow indirect data flow<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n