Getting Started
There are two ways to execute SQL queries in Stacks on Chain: https://app.signal21.io/query and through the API.
The website and API support PostgreSQL dialect. For more information check the official PostgreSQL documentation (https://www.postgresql.org/docs/14/index.html). Only the SELECT statement is supported.

These are some tables that you'll be using. They are the low-level transactional data the node transmits providing detailed records of all activity on the blockchain. As seen in the above diagram, it is (kind of) a star schema centered around the transactions table. The tables above that record all transactions for all tokens are :
fungible token related events (
ft_events
)NFT related events (
nft_events
)STX related events (
stx_events
)PoX related events (
pox
).
function_args
table contains the record of all the arguments passed into the function call, for example in the event of a purchase of a Megapont ape, the nft_events
table will contain which ape was purchased, the sender, and the new recipient while the function_args
table will record the price that it was bought for (the argument that was passed to the purchase function).
For the complete list of tables look at Tables section
Last updated