提示词库

数据分析提示词

用于处理数据的提示词:根据表结构编写 SQL、检查数据集的质量问题,以及解释结果。

提示词是英文的,即它们的编写和测试所用的语言。这些页面上的说明和指引已翻译。

  • sql
  • queries
  • analytics
100/100 · 158 token

根据表结构编写 SQL 查询

针对一个问题编写 SQL 查询,只使用你提供的表结构中的表和列。

适用场景: 你知道想问数据什么,但不清楚该怎么连接表。

prompt
You are a senior data analyst writing SQL.

## Task
Write one SQL query that answers the question below, using the schema provided.

## Requirements
- Use only tables and columns that appear in the schema.
- Use explicit JOIN syntax and qualify every column with its table alias.
- Never use SELECT *.
- State the SQL dialect the query is written for.
- Write "the schema cannot answer this" and name the missing column when the question needs data the schema lacks.

## Output format
Return one SQL code block, followed by a numbered list explaining each join and filter, and a bulleted list of assumptions.

## Input
<question>
{{question}}
</question>

<schema>
{{schema}}
</schema>

<dialect>
{{dialect}}
</dialect>

变量

{{question}}
要回答的问题。
{{schema}}
CREATE TABLE 语句,或带列和类型的表清单。
{{dialect}}
数据库,例如 PostgreSQL 或 BigQuery。

示例输入

question: monthly revenue per country for 2025
schema: orders(id, customer_id, total, created_at); customers(id, country)
dialect: PostgreSQL

示例输出

```sql
SELECT c.country, date_trunc('month', o.created_at) AS month, SUM(o.total) AS revenue
FROM orders AS o
JOIN customers AS c ON c.id = o.customer_id
WHERE o.created_at >= '2025-01-01' AND o.created_at < '2026-01-01'
GROUP BY c.country, month;
```

仅为示意:为展示预期的形式而编写,并非由模型生成。

  • data quality
  • cleaning
  • profiling
100/100 · 148 token

数据集质量检查

检查数据样本中的缺失值、不一致的格式、重复项和异常值。

适用场景: 在分析或模型训练之前,需要知道应该先清理什么。

prompt
You are a senior data analyst profiling a dataset.

## Task
Review the data sample below and report its quality problems.

## Requirements
- Check each column for missing values, mixed formats, duplicates, and values outside a plausible range.
- Cite the row for every problem you report.
- Report only problems visible in the sample; never estimate rates for the full dataset.
- Recommend one cleaning step per problem.
- State which checks need the full dataset to confirm.

## Output format
Return a markdown table with the columns Column, Problem, Example row, and Cleaning step, followed by a bulleted list titled Needs the full dataset.

## Input
<sample>
{{sample}}
</sample>

<description>
{{description}}
</description>

变量

{{sample}}
表头行以及数据集中至少 20 行。
{{description}}
每一列应包含的内容。

示例输入

sample: rows with dates as both 2025-01-03 and 03/01/2025, and one age of 212.
description: signup_date is a date; age is in years.

示例输出

| Column | Problem | Example row | Cleaning step |
|---|---|---|---|
| signup_date | Two date formats | Row 7: 03/01/2025 | Parse both formats and store ISO 8601 |
| age | Implausible value | Row 12: 212 | Set to null and flag for review |

仅为示意:为展示预期的形式而编写,并非由模型生成。

改成你的

修改需求以符合你的标准,然后检查结果。提示词分析器会在你输入时重新评分,优化器会在不丢失任何需求的前提下去掉冗词,安全扫描器会在你发送给模型之前标出密钥和个人数据。

更多类别