Function Repository Resource:

# QueryTreeForm

Present a query as a tree

Contributed by: Seth J. Chandler
 ResourceFunction["QueryTreeForm"][q] presents a Query q as a tree in which the order of operations is the depth-first descent of the tree. ResourceFunction["QueryTreeForm"][{op1,op2,…,opn}] presents a list of operations for Query as a tree with depth-first descent.

## Details and Options

ResourceFunction["QueryTreeForm"] takes the same options as TreeForm.

## Examples

### Basic Examples

Show the order of operations of a Query that is constructed of an ascending operator f and an ascending operator g as its arguments:

 In[1]:=
 Out[1]=

Show the order of operations of a Query that is constructed of: (1) a right composition of two descending operators and an ascending operator; (2) the All operator; and (3) the ascending operator i:

 In[2]:=
 Out[2]=

### Scope

Visualize a Query composed of an ascending and a descending operator to aggregate values of a column after filtering the rows:

 In[3]:=
 Out[3]=

Visualize the order of operations of a Query that applies functions to each column independently:

 In[4]:=
 Out[4]=

Visualize a Query that constructs a new table by specifying operators that will compute each column:

 In[5]:=
 Out[5]=

### Options

All the options of TreeForm are available to this function:

 In[6]:=
 Out[6]=

### Applications

QueryTreeForm is useful in thinking through the order of operations in complex queries :

 In[7]:=
 Out[7]=

### Properties and Relations

QueryTreeForm can be combined with other visualization functions to present additional information:

 In[8]:=
 Out[8]=

### Possible Issues

Any ResourceFunction that does not format well within TreeForm does not format well in QueryTreeForm either:

 In[9]:=
 Out[9]=

### Neat Examples

Determine the order of operations in a Query designed to produce several statistics broken down by gender of a dataset involving age, gender and class:

 In[10]:=
 Out[10]=

A function that, if applied to the Titanic dataset, will yield a breakdown of survival by gender and class in an attractive format:

 In[11]:=
 In[12]:=
 Out[12]=