sql-queries

Generate SQL queries for Snowflake, BigQuery, Databricks, and PostgreSQL.

1|Updated May 7, 2022
One-click install
npx skills add https://github.com/brandonburrus/dotfiles --skill sql-queries-brandonburrus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-queries
Source: https://github.com/brandonburrus/dotfiles/tree/main/.agents/skills/sql-queries
Command: npx skills add https://github.com/brandonburrus/dotfiles --skill sql-queries-brandonburrus

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps users write correct, performant, and readable SQL queries across various major data warehouse dialects, simplifying complex data analysis and optimization tasks.

Core Features & Use Cases

  • Cross-Dialect SQL Generation: Write SQL compatible with Snowflake, BigQuery, Databricks, PostgreSQL, and Redshift.
  • Query Optimization: Improve the performance of slow-running SQL queries.
  • Complex Query Construction: Build advanced queries using CTEs, window functions, and aggregations.
  • Dialect Translation: Convert SQL queries between different database systems.
  • Use Case: You need to write a complex analytical query involving window functions and CTEs to calculate monthly active users for a product, and you need it to run efficiently on BigQuery.

Quick Start

Use the sql-queries skill to write a BigQuery SQL query that calculates the 7-day rolling average of daily active users from a table named 'user_activity'.

Frequently Asked Questions about sql-queries

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write performant SQL queries for BigQuery using CTEs and window functions?

To write performant SQL for BigQuery, you construct complex analytical queries using CTEs, window functions, and aggregations. This approach calculates metrics like rolling averages efficiently while ensuring dialect-specific syntax correctness and optimized performance.

What is the best way to translate SQL queries between Snowflake and PostgreSQL?

Translating SQL between Snowflake and PostgreSQL involves converting dialect-specific syntax to match the target data warehouse. This ensures cross-dialect compatibility while maintaining the original query logic, complex aggregations, and analytical structure.

How do I optimize slow SQL queries in Databricks?

Optimizing slow SQL in Databricks requires analyzing the query structure and applying performance tuning techniques. This process refactors complex analytical queries with CTEs and window functions to improve execution speed and reduce compute costs.

Does this SQL generation approach support data warehouse specific syntax for Snowflake?

Yes, SQL generation supports dialect-specific syntax for major data warehouses including Snowflake, BigQuery, Databricks, and PostgreSQL. It generates correct, performant queries tailored to the unique requirements of your chosen platform.

Can I build complex analytical queries with window functions for data warehousing?

Yes, you can build complex analytical queries using window functions, CTEs, and aggregations. This allows you to calculate advanced metrics like monthly active users efficiently across your data warehouse platforms.