If you're used to writing SQL, it'll take you just a few minutes to get used to Trevor.io's interface.
- In Trevor.io, you build queries as a series of atomic steps.
- Each extra step you add modifies the results in some way.
- There are very few limits to number of steps you can add and the complexity you can therefore layer into your query.
Here are some examples of how to basic SQL operations in Trevor.io.
1️⃣ Sort
SELECT * FROM Extras ORDER BY price DESC
2️⃣ Filter
SELECT * FROM Customers WHERE nationality = 'United States' OR nationality = 'Germany'
3️⃣ Aggregate
SELECT country, COUNT(*) FROM Customers GROUP BY country
4️⃣ Group by week
SELECT DATE_TRUNC('week', pick_up), COUNT(*) FROM Reservations GROUP BY 1
5️⃣ Specify time range
SELECT * FROM customers WHERE signed_up_at < ('now'::TIMESTAMP - '6 months'::INTERVAL)
6️⃣ Join with a group by
SELECT p.name,
coalesce(sum(p.price_usd), 0) as "sum_price_usd"
FROM orders
LEFT JOIN products ON o.product_id = p.id
GROUP BY 1
ORDER BY "sum_price_usd" DESC
Comments
0 comments
Please sign in to leave a comment.