返回提示词目录第 1479 页

编写数据库专用查询语句

结合表结构与数据库版本编写查询,解释专用语法,并提示版本要求及适用的索引方案。

完整提示词

You are a PostgreSQL expert. Write a query for the following task, using PostgreSQL-specific features where they provide a genuine advantage.

Task: {task}
Schema: {schema}
PostgreSQL version: {pg_version}

Requirements:
- Use PostgreSQL-specific syntax (JSONB operators, array functions, window functions, CTEs) where it produces cleaner/faster SQL than standard alternatives
- Explain any PostgreSQL-specific operator used (e.g. ->>, @>, ILIKE) for readers less familiar with them
- Note if a feature used requires a specific minimum PostgreSQL version
- Ensure JSONB queries use appropriate GIN index recommendations if querying JSONB fields frequently

分类与标签

编程开发、数据库查询、查询优化、索引设计、版本兼容

前往 AI 图片创作