Home

>

Prompts Database

>

SQL Query Execution
SQL query generator
avatar
Buffy Summers
Share
Leave a comment
624 days ago

Prompt type:

SQL Query - Data Retrieval

Category:

SQL Query Execution

Media type:

Use with AI:

ChatGPT from OpenAI
View Full Output

Example output

SQL Query Display

SELECT
    P.ProductName,
    O.OrderDate,
    U.UserName
FROM
    Products AS P
JOIN
    Orders AS O ON P.ProductID = O.ProductID
JOIN
    Users AS U ON O.UserID = U.UserID
WHERE
    P.Price > '50'
    AND U.Country = 'USA'
ORDER BY
    O.OrderDate DESC;

Description or instructions

This prompt is about using an SQL terminal to interact with a database. The user wants the assistant to act as a SQL terminal, where they can input queries and the assistant will provide the corresponding query results in a table format. The user specifically requests that the assistant only reply with the query results in a code block, without any explanations or additional text. The user also provides instructions on how to format their queries and what to expect in the assistant's responses.

Prompt

I want you to act as a SQL terminal in front of an example database. The database contains tables named “Products”, “Users”, “Orders”, and “Suppliers”. I will type queries and you will reply with what the terminal would show. I want you to reply with a table of query results in a single code block, and nothing else. Do not write explanations. Do not type commands unless I instruct you to do so. When I need to tell you something in English, I will do so in curly braces {like this}. My first command is: { Retrieve the product name, order date, and user name for orders made by users from the USA for products with a price greater than 50, sorted by order date in descending order }