Tips
Examples
To play along with these example, you can setup a Sequin database connected to the Airtable Inventory Tracker template.CAST
Airtable Formulas and Lookup Values can be numbers, strings, dates, or timestamps. So these fields are stored in your Postgres database as text and text[] columns, respectively.
Let’s say you want to calculate your total revenue using SQL. Yo do so, you’ll sum up the total_price for all the purchase orders. Since total price is a formula in Airtable, we record it as type text in your Sequin database. So to calculate your total revenue, you’ll need to cast the total_price as an integer:
:: casts the total_price column to an integer to then calculate the sum.
Answer: Total revenue is \$17,280.
JOIN with ANY
A JOIN will let you use your Airtable data in new ways.
For example, let’s say you want to use your warehouse space better. It would be helpful to see how many products are on each shelf in your warehouse.
To do so, you can JOIN the warehouse_locations table with the product_inventory table and calculate the total inventory of all the products on each specific shelf:
ANY. When performing the JOIN, there are many products associated with each warehouse location. These values are stored in an array. With ANY, you can JOIN on each value in the array.

UNION
You’d like to send your design team all your product images scattered across your product inventory and your purchase orders.
To do so, you need to do a UNION of the product_inventory table and the purchase_orders table:


