# Read-only SQL — prompt for Gemma

Prepare a SELECT query from the supplied schema and check whether joins duplicate the intended rows.

Canonical URL: https://boswidget.ru/en/read-only-sql-prompt-for-gemma/

Model: Gemma

Category: Code

Tags: SQL, SELECT, data

![Read-only SQL](https://boswidget.ru/assets/images/text-preview-gemma-readonly-sql-1200.8395a535cc3f.webp)

Read-only SQL

## Prompt

Write a read-only query for {database}. Table schema and relationships: {schema}. Task: {task}. Use only the specified tables and fields, passing condition values as parameters. Explain joins, grouping, NULL handling and possible duplicates. If a field or relationship is missing, ask rather than guess. Give a small fictional dataset, clearly label it as an example, and show the expected result. Do not claim to have executed the query.

## Template fields

- `{database}` — DBMS. Example input: For example: PostgreSQL 16
- `{schema}` — Schema. Example input: Tables, fields, types and keys without real personal information
- `{task}` — What to choose. Example input: Required rows, fields, filters and output order

## Launch

[Open Gemma in YesAI](https://yesai.su/en/gemma)
