プロンプトライブラリ

データ分析のプロンプト

データを扱うためのプロンプト:スキーマからの SQL 作成、データセットの品質チェック、結果の解説。

プロンプト本体は、作成・テストした言語である英語です。これらのページの説明と案内文は翻訳されています。

  • sql
  • queries
  • analytics
100/100 · 158 トークン

スキーマからの 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 トークン

データセットの品質チェック

データのサンプルを、欠損値、不統一な形式、重複、外れ値の観点でレビューします。

使う場面: 分析やモデル学習の前に、何から整えるべきか知る必要があるとき。

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 |

例示です。期待される形を示すために書いたもので、モデルが生成したものではありません。

自分用に調整する

要件を自分の基準に合わせて編集し、結果をチェックしましょう。プロンプトアナライザーは入力に合わせて再採点し、オプティマイザーは要件を落とさずに冗長な表現を削り、セキュリティスキャナーはモデルに送る前に秘密情報や個人データを検出します。

その他のカテゴリ