Conceptually, UNNEST and CROSS JOIN create ate a new table with a crazy number of lines, because each line of the source table is multiplied by the number of lines of the nested event_params structure. For all rows where the main table user ID coincides with the main table user ID, we fill in a new column called user_did_click with the actual value. Here, in the Attracted_users column, you will find the number of unique user IDs in the table where these users have collected an event called user_engagement at any time. The query continues to scroll through the source table line by line, but this time you can query different rows in the calculations. The purpose of the subquery is to perform calculations based on the table data and return the result of these calculations to the surrounding query. All selected query strings are still processed, even if the HAVING operator removes some of them from the results table. This concept is difficult for many to understand, but since UNNEST and CROSS JOIN simply fill in the table from the start, as if it were a flat structure, it should help you create the desired questions. In the previous query we assumed that more than one device could be assigned to one user in the requested table. The analysis functions can be very difficult to understand because with SQL you are used to viewing tables row by row and comparing queries row by row. The main question combines this with some of the unique user IDs without restrictions, so you get both counters in the same table. The query is similar to the previous chapter, but this time we are grouping not by device category, but by user and calculating the number of unique device categories with which each user has visited the site. LEFT MUNITIES accepts all rows of the table “to the left” and the corresponding rows of the table “to the right”.