Best Practices for SQL Assist

Prev Next

SQL Assist is an AI-powered assistant within the Migrate module, designed to enhance your productivity during the data migration processes. it helps with writing, understanding, and refining SQL queries for supported database systems. To maximize its benefits and ensure accurate results, you need to know how to collaborate with it effectively. Clear, specific prompts with relevant context enable SQL Assist to provide highly accurate responses.

Consider the following best practices when using SQL Assist:

Understand SQL Assist's Capabilities

Note

SQL Assist is not designed to respond to prompts unrelated to SQL queries, database operations, and query analysis.

Familiarize yourself with what SQL Assist excels at:

  • Creating SQL: Generating new SQL statements from natural language descriptions.

  • Explaining SQL: Providing clear explanations of existing SQL code.

  • Customizing SQL: Modifying existing statements based on your instructions.

  • Reviewing SQL: Analyzing your SQL for potential improvements or issues.

Remember that SQL Assist generates suggestions based on patterns and the context provided. Always review its response.

Craft Clear and Specific Prompts

The quality of SQL Assist's output heavily depends on the clarity and specificity of your questions or prompts.

  • Be explicit: Instead of "show customer data," try "create a SQL query to show the first name, last name, address, and email for all customers in the 'dbo.Customers' table located in California, ordered by last name."

  • Specify intent: Clearly state if you want SQL Assist to create, explain, customize, or review a SQL statement.

  • Mention database objects: When relevant, add schema objects to the context and mention them in your prompt, especially when building Report or ETL Task DDL. Use the Select Schema Objects feature to add context.

Tips for Effective Prompting

Tip

Explanation

Converse using natural language

Communicate using plain language. You don’t need technical terms, but try to avoid slang or overly casual expressions.

Be clear and specific

Clearly state your request, output, and include sufficient detail so SQL Assist understands exactly what you need.

Provide context

While SQL Assist uses the selected datastore and the query in the current tab as context, adding details like specific database objects can help improve results.

Provide examples

Iterate on previous responses with an example, such as “Update the previous query to sort by LastOrderDate.”

Iterate and Refine Your Prompt

Break down complex queries, ask SQL Assist to generate parts of the query sequentially, then combine them. If the initial SQL generated by SQL Assist isn't perfect, don't hesitate to refine your prompt. Provide feedback in your next prompt: For example, That's a good start, but also include the order date and filter out orders before 2025.

If you find a particular conversation is no longer helpful, delete that conversation and start a new chat.

Always Review and Validate SQL Assist's Output

Carefully examine any SQL code suggested by SQL Assist before execution. Ensure it aligns with your intent and is safe to run in your environment. Use SQL Assist's capability to explain a query if you're unsure about what a generated query does.

When the Auto-Apply changes feature is enabled, SQL Assist will directly modify the query in your current tab. Remember, SQL Assist only auto-applies query changes; execution is always a manual step performed by you.

Use SQL Assist for Learning

SQL Assist can be a valuable learning tool. If you encounter unfamiliar SQL syntax or a complex query, ask SQL Assist to explain it. Alternatively, you ask SQL Assist to suggest different ways to achieve the same result, which can help you learn new techniques or optimize queries.

Related Articles