About sql-query
sql-query is a skill for generating SQL for data retrieval, analysis, and reporting. It covers common statements, complex query patterns, and performance guidance.
Key features
- 01Generate CRUD queries
- 02Build JOINs and subqueries
- 03Use aggregates and window functions
- 04Get query performance guidance
Use cases
- 01Write SQL for data retrieval
- 02Aggregate data for reports
- 03Analyze grouped and ranked results
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ tatat/ agents-playground --skill sql-queryAfter installing, type/sql-queryin Claude Code to confirm it loaded.
Details
From the project READMESQL Query
Generate SQL queries for data retrieval, analysis, and reporting.
Capabilities
- Generate SELECT, INSERT, UPDATE, DELETE queries
- Build complex JOINs and subqueries
- Aggregate data with GROUP BY and window functions
- Optimize query performance
Query Patterns
Basic Select
SELECT column1, column2
FROM table_name
WHERE condition
ORDER BY column1
LIMIT 100;
Aggregation
SELECT category, COUNT(*) as count, AVG(price) as avg_price
FROM products
GROUP BY category
HAVING COUNT(*) > 10;
Window Functions
SELECT
name,
department,
salary,
RANK() OVER (PARTITION BY department ORDER BY salary DESC) as rank
FROM employees;
Best Practices
- Always use parameterized queries to prevent SQL injection
- Index columns used in WHERE and JOIN clauses
- Avoid SELECT * in production queries
- Use EXPLAIN to analyze query performance
Comments
Markdown supported