Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update query for the tutorial (#484) #485

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions learning/how-tos/create-your-first-query.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ GROUP BY

## Crafting Your Query

1. **Identify Your Columns**: Once you've zeroed in on the right table, pinpoint the `tx_fee_usd` column to track USD gas expenditures. To specify the wallet you're examining, use the `tx_sender` field. For demonstration purposes, we'll be using Vitalik's wallet (0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045).
1. **Identify Your Columns**: Once you've zeroed in on the right table, pinpoint the `tx_fee_usd` column to track USD gas expenditures. To specify the wallet you're examining, use the `tx_from` field. For demonstration purposes, we'll be using Vitalik's wallet (0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045).

2. **Aggregation & Time Period**: Our goal is to get monthly gas spendings, so we need to truncate the `block_date` to month and applying the `SUM()` function, then group by each month go derive the results.

Expand All @@ -46,7 +46,7 @@ SELECT
SUM(SUM(tx_fee_usd)) OVER (ORDER BY DATE_TRUNC('month', block_date)) AS cumulative_gas_spent
FROM gas.fees
WHERE
tx_sender = 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 -- vitalik.eth
tx_from = 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 -- vitalik.eth
GROUP BY
1
ORDER BY
Expand All @@ -58,7 +58,7 @@ Here is the [link to demo query](https://dune.com/queries/3100875).

## Boost Flexibility with Parameters

In the example, you'll see `tx_sender = \{\{Your Wallet Address}} -- default is vitalik.eth`. This denotes the use of the parameter feature, enhancing the query's flexibility. To mark a field as a parameter, wrap it in "". Alternatively, activate the "Add Parameter" button.
In the example, you'll see `tx_from = \{\{Your Wallet Address}} -- default is vitalik.eth`. This denotes the use of the parameter feature, enhancing the query's flexibility. To mark a field as a parameter, wrap it in "". Alternatively, activate the "Add Parameter" button.

<div
style={{
Expand Down Expand Up @@ -92,7 +92,7 @@ SELECT
SUM(SUM(tx_fee_usd)) OVER (ORDER BY DATE_TRUNC('month', block_date)) AS cumulative_gas_spent
FROM gas.fees
WHERE
tx_sender = {{Your Wallet Address}} -- default is vitalik.eth
tx_from = {{Your Wallet Address}} -- default is vitalik.eth
GROUP BY
DATE_TRUNC('month', block_date)
ORDER BY
Expand Down