sql-queries

Generate SQL queries across PostgreSQL, Snowflake, BigQuery, Redshift, and Databricks SQL.

Updated Feb 12, 2026
One-click install
npx skills add https://github.com/Bauhaus-InfAU/infau-skill-base --skill sql-queries-bauhaus-infau
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-queries
Source: https://github.com/Bauhaus-InfAU/infau-skill-base/tree/main/data/skills/sql-queries
Command: npx skills add https://github.com/Bauhaus-InfAU/infau-skill-base --skill sql-queries-bauhaus-infau

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 database dialects, optimizing query performance and reducing development time.

Core Features & Use Cases

  • Cross-Dialect Support: Provides syntax and performance tips for PostgreSQL, Snowflake, BigQuery, Redshift, and Databricks SQL.
  • Complex Query Patterns: Includes examples for window functions, CTEs, cohort retention, funnel analysis, and deduplication.
  • Debugging Assistance: Offers guidance on common SQL errors like syntax issues, type mismatches, and division by zero.
  • Use Case: You need to write a complex SQL query to calculate monthly active users and their retention rates for a BigQuery dataset, and you're unsure about the exact syntax for window functions and date truncations.

Quick Start

Use the sql-queries skill to write a PostgreSQL query that calculates the 7-day moving average of daily sales.

Frequently Asked Questions about sql-queries

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

FAQPage Schema
How do I write a SQL query for cohort retention analysis in BigQuery?

You can calculate cohort retention in BigQuery by using SQL window functions and date truncations to group users by their first event date and measure their subsequent return activity over specific time intervals.

What is the best way to optimize SQL performance tuning for Snowflake data warehousing?

Optimizing SQL performance tuning for Snowflake involves using Common Table Expressions (CTEs) to structure complex queries cleanly and applying dialect-specific patterns to reduce unnecessary data scans and computation overhead.

How do I fix a division by zero error in PostgreSQL window functions?

Fix a division by zero error in PostgreSQL window functions by wrapping the divisor in a NULLIF function, which returns NULL instead of throwing an error when the denominator evaluates to zero during the calculation.

Does this SQL query generator support Redshift and Databricks SQL dialects?

Yes, the SQL query generator supports Redshift and Databricks SQL dialects, providing correct syntax, performance tips, and readable query patterns specific to each data warehouse environment.

How do I deduplicate rows using CTEs in a SQL database?

Deduplicate rows using SQL CTEs by assigning a row number partitioned by your unique identifier, then filtering for row number one to retain only the latest or most relevant record per group.