sql-queries

Write performant SQL queries for analytical databases across multiple dialects.

1|Updated Feb 19, 2026
One-click install
npx skills add https://github.com/cyyeh/duckdb-data-agent --skill sql-queries-cyyeh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-queries
Source: https://github.com/cyyeh/duckdb-data-agent/tree/main/plugins/data/skills/sql-queries
Command: npx skills add https://github.com/cyyeh/duckdb-data-agent --skill sql-queries-cyyeh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps analysts and engineers write correct, efficient, and portable SQL for analytical workloads by addressing dialect differences, performance pitfalls, and common aggregation patterns so queries run reliably across Snowflake, BigQuery, PostgreSQL, Redshift, and Databricks.

Core Features & Use Cases

  • Cross-dialect translations: Examples and idioms for PostgreSQL, Snowflake, BigQuery, Redshift, and Databricks to translate queries and adapt syntax.
  • Performance guidance: Tips for partitioning/clustering, indexing/distribution strategies, and techniques like using EXISTS, avoiding SELECT *, and choosing appropriate aggregation approaches.
  • Analytical patterns: Ready patterns for window functions, cohort analysis, funnel conversions, deduplication, and CTE-based readable pipelines.
  • Error handling & debugging: Practical checks for syntax differences, type mismatches, ambiguous columns, and grouping errors with dialect-aware remedies.

Quick Start

Generate a BigQuery-compatible SQL query that computes a 7-day rolling average of revenue per user, handles nulls safely, and filters by a partitioned date column.

Frequently Asked Questions about sql-queries

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

FAQPage Schema
How do I optimize slow SQL queries in BigQuery or Snowflake?

Optimize slow SQL queries by applying performance best practices like using EXISTS, avoiding SELECT *, and leveraging partitioning or clustering strategies specific to your data warehouse architecture.

How do I translate a PostgreSQL query to BigQuery syntax?

Translate PostgreSQL queries to BigQuery by adjusting dialect-specific syntax, handling type mismatches, and resolving ambiguous columns to ensure the query runs reliably across different analytical databases.

What is the best way to write window functions for cohort analysis in SQL?

Write window functions for cohort analysis by using ready-made analytical patterns and CTE-based readable pipelines that safely compute aggregations and handle nulls across your data warehouse.

Does this approach support building CTEs and large-scale aggregations in Redshift?

Yes, this approach supports building CTEs and large-scale aggregations in Redshift by providing dialect-aware syntax, performance guidance, and error-handling checks tailored for analytical workloads.

Why does my SQL query fail with grouping errors in Databricks?

SQL queries fail with grouping errors in Databricks due to syntax differences or ambiguous columns, which can be resolved using dialect-aware remedies and practical debugging checks.