PTR logo

Tech Tips

What Is Prompt Engineering?

The art of crafting well thought out text that can be fed to AI tools

Motion graphic.
What Is Prompt Engineering?

Prompt Engineering is the art of crafting well thought out text that can be fed to AI tools and models to provide accurate outputs that are in the right context for your request.

Provide as much information, guidance, context and structure as you can, drawing on your experience and knowledge of your business requirement and the landscape related insight that might be required to enable the AI tool to give you exactly what you need.

Remember that AI is here to enhance your skills and save you time, not to replace you. You have the knowledge, AI has the resource to process quickly.

Good v Bad Prompt Engineering

Let's look at an example of good v bad prompt engineering. We need to write a SQL query to calculate monthly active users.


If we just ask the following question:

"Write a SQL query to calculate monthly active users"

We ask Chat GPT to help us:

Content image

Where is the context around what an active user is? What are the relevant fields and tables called? This SQL statement is unusable. AI guesses what an active user might be, guesses the columns involved and guesses the tables involved.


If we ask a more informed question with context and guidance we will get a more useful and accurate SQL statement:

"Act as a Senior Snowflake SQL Data Engineer. Write a query to calculate Monthly Active Users (MAU) and Gross Revenue for 2025 from the core_sales.transactions table.

Use these business rules:

  1. MAU is defined as a unique user_id with an interaction_type of 'purchase' or 'login'.

  2. Gross Revenue is the sum of amount_usd where status equals 'completed'.

  3. Exclude all internal test_user_id values listed in the core_sales.internal_testers table.

Group the results by calendar month and sort chronologically. Add inline comments explaining the logic."

We put this prompt engineered request to Chat GPT and the following query was returned:

Content image

The context and structure defining the hosting platform, business logic, required filters and exact output format eliminates the guesswork and provides a quality response.

Share This Post

MD

Mandy Doward

Managing Director

PTR’s owner and Managing Director is a Microsoft certified Business Intelligence (BI) Consultant, with over 35 years of experience working with data analytics and BI.

Latest Articles

Frequently Asked Questions

Couldn’t find the answer you were looking for? Feel free to reach out to us! Our team of experts is here to help.

Contact Us