Associate the product IDs with the product names

We're going to be building on the previous query- because product IDs only go so far- we need to know the names of the products!

1. In order to see the product names of the product ids, weโ€™ll need to write a CTE. From there, weโ€™ll need to JOIN the ProductInformation collection via product_id:

2. Action Item: Delete all the SQL code in the editor we just worked on and apply the code snippet below. We're going to build a CTE, a common table expression, so that we can write a sub-query. Our first query will look like this- don't run the query just yet! You'll notice we're building from our previous query in the last section:

Major SQL code highlights:

  • We added lines 12-19.

  • On line 1, we created a named result set called purchases.

  • On line 18, we JOIN the ProductInformation collection via the product ids.

3. When we Run the query, the results will look like this:

NOTE: You can find us on the Rockset Community if you have questions or comments about the workshop.

Last updated