Skip to main content
Back to Library
Prompt Engineering Guide

Mastering Write SQL query
on SambaNova Llama 405B

Stop guessing. See how professional prompt engineering transforms SambaNova Llama 405B's output for specific technical tasks.

The "Vibe" Prompt

"Write a SQL query to select all users from the 'users' table who have an email address ending with '@example.com' and joined after '2023-01-01'."
Low specificity, inconsistent output

Optimized Version

STABLE
You are a SQL expert. Your task is to write a SQL query based on the following instructions. ### Instructions: 1. Select all columns from the 'users' table. 2. Filter the results where the 'email' column ends with '@example.com'. 3. Further filter the results where the 'join_date' column is after '2023-01-01'. ### Constraint: - Do not include any comments in the SQL query. - Ensure the syntax is compatible with PostgreSQL. ### Example: User Table Structure: | id | name | email | join_date | |----|------|----------------|--------------| | 1 | John | john@example.com | 2022-12-15 | | 2 | Jane | jane@test.com | 2023-01-20 | | 3 | Bob | bob@example.com | 2023-02-01 | SQL Query: ```sql SELECT * FROM users WHERE email LIKE '%@example.com' AND join_date > '2023-01-01'; ``` ### Your Turn: Write the SQL query based on the instructions.
Structured, task-focused, reduced hallucinations

Engineering Rationale

The optimized prompt breaks down the request into clear, numbered instructions, which aids the model in processing each step sequentially. It provides specific constraints (no comments, PostgreSQL compatibility) to guide the output format. The inclusion of a concrete example with both table structure and the expected SQL query demonstrates the desired output unequivocally, reducing ambiguity. This structured approach, combined with the 'You are a SQL expert' persona and 'Your Turn' call to action, directs the model towards generating precise and correct SQL, mimicking a chain-of-thought process without explicitly demanding reasoning steps in the output.

0%
Token Efficiency Gain
The generated SQL query selects all columns.
The generated SQL query correctly filters by email ending with '@example.com'.
The generated SQL query correctly filters by join_date after '2023-01-01'.

Ready to stop burning tokens?

Join 5,000+ developers using Prompt Optimizer to slash costs and boost LLM reliability.

Optimize My Prompts