SQL Generation

中级data最低上下文:16K

Generates optimized SQL queries from natural language descriptions. Supports multiple dialects (PostgreSQL, MySQL, SQLite, SQL Server), handles complex joins, subqueries, window functions, and CTEs. Includes query explanation and performance optimization hints.

使用场景

  • Converting business questions to SQL queries
  • Optimizing slow queries with EXPLAIN analysis
  • Generating migration scripts
  • Building complex reporting queries
  • Database schema design from requirements

示例提示词

Generate a PostgreSQL query for the following requirement:

"Find the top 10 customers by total order value in the last 30 days,
including their order count and average order value. Exclude customers
who have any cancelled orders."

Schema context:
- customers (id, name, email, created_at)
- orders (id, customer_id, total, status, created_at)

Requirements:
- Use CTEs for readability
- Include performance hints (indexes to consider)
- Explain the query logic step by step

推荐模型

兼容工具

claude-codecursorgithub-copilotkiroany

模态

输入: text
输出: code, text

相关 Skills

作者

OpenModels Community

@openmodelsrun