liveBook · Manning

Zero-shot prompting

As explained in Learn AI Data Engineering

Zero-shot prompting is a prompting technique that asks a model to perform a task without providing task-specific examples.

Zero-shot prompting gives a large language model one direct, plain-language instruction without task-specific examples, schemas, or setup. The response relies on the model’s pre-trained knowledge plus the wording in the prompt. It is useful when a familiar dataset or simple public API supplies enough implied context to begin quickly. section 3.1 section 4.1.1

Treat the response as a draft, not an answer to trust automatically. Wording can change the model’s interpretation, and generated SQL may vary in aliases, formatting, comments, or style. Extract the executable portion, run it against the actual system, and judge it by correct logic and results. section 3.1

Querying a familiar rental schema

Prompt: “Using the Pagila dataset, write a SQL query to list the top 5 most rented films.” A generated query can join rental, inventory, and film; count rentals by title; sort descending; and limit the result to five. Paste the SQL into pgAdmin and verify the returned rows. section 3.1

SELECT f.title, COUNT(*) AS rental_count
FROM rental r
JOIN inventory i ON r.inventory_id = i.inventory_id
JOIN film f ON i.film_id = f.film_id
GROUP BY f.title
ORDER BY rental_count DESC
LIMIT 5;

This SQL listing makes the zero-shot result concrete: it joins the rental tables, counts rentals per film, orders by the count, and returns five titles. section 3.1

Generating a resilient API script

Prompt: “Write a Python script that takes a list of numbers, queries the NumbersAPI for trivia facts, and stores the results in a pandas DataFrame. Handle errors gracefully if a request fails.” The requested output combines HTTP requests, JSON parsing, error handling, logging, and tabular storage; refine it when interactive feedback or retries are needed. section 4.1.1

How Learn AI Data Engineering covers it

How deep it goes
Defines the technique and demonstrates validation, while deferring richer prompt structures to few-shot prompting and chain-of-thought.
Examples
Demonstrates a top-five rented-films query and a NumbersAPI trivia collector stored in a pandas DataFrame.
What it assumes
Assumes access to ChatGPT and a runnable Python notebook or IDE for the API workflow.
What you can do after
Apply it via ChatGPT to generate a starting query or script, then validate and refine the output.
How it connects
Connects SQL, Pagila, ChatGPT, pgAdmin, APIs, Python, pandas, logging, and error handling.

Also explained in

Compare how 12 books explain zero-shot prompting →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn AI Data Engineering. The section links point to the parts of the book it draws on.