liveBook · Manning

Pseudocode

As explained in AI for Everyday IT

Pseudocode is an informal, language-independent notation for expressing the logic and operations of an algorithm.

Pseudocode expresses a calculation as short, ordered instructions without requiring a conversational explanation. In database prompting, it tells a chatbot how to transform values, apply conditions, and reduce redundant SQL. section 10.6.2

Memory calculation prompt

Request a SQL query that retrieves selected memory columns, converts values ending in M or G to megabytes, and calculates Total Memory in Use: when memory_max_target is not zero, use it; otherwise add sga_max_size and pga_aggregate_target. Ask for reduced redundancy. section 10.6.2

SELECT
    [SERVERNAME], [DB_NAME], [memory_target], [memory_max_target],
    [pga_aggregate_target], [sga_max_size], [PhysicalMemory]
FROM
    [dbo].[vOracleMemoryConfigs]

 server1    DB1    0    0    2000M    6G    15297

A compact listing establishes the selected columns and table before the calculation logic is added. section 10.6.2

figure
-- CTE for converting memory settings to MB and calculating total memory
   in use
WITH MemoryCalculations AS (
    SELECT
        [SERVERNAME],
        [DB_NAME],
        [PhysicalMemory],
        CASE
            WHEN RIGHT([memory_max_target], 1) = 'M' THEN CAST(SUBSTRING(
              [memory_max_target], 1, LEN([memory_max_target]) -              1) AS INT)
            WHEN RIGHT([memory_max_target], 1) = 'G' THEN CAST(SUBSTRING(
              [memory_max_target], 1, LEN([memory_max_target]) - 1)
              AS INT) * 1024
            ELSE [memory_max_target]
        END AS [memory_max_target_MB],
...
),
-- Second CTE for calculating total memory in use
FinalCalculations AS (
    SELECT
        [SERVERNAME],
        [DB_NAME],
        [PhysicalMemory],
        CASE
            WHEN [memory_max_target_MB] != 0 THEN [memory_max_target_MB]
            ELSE [sga_max_size_MB] + [pga_aggregate_limit_MB]
        END AS [TotalMemoryInUse_MB]
    FROM
        MemoryCalculations
)
SELECT
    *,
    ([TotalMemoryInUse_MB] * 1.0 / [PhysicalMemory]) * 100
       AS [TotalMemoryInUse_Percentage]
FROM
    FinalCalculations
WHERE
    ([TotalMemoryInUse_MB] * 1.0 / [PhysicalMemory]) * 100 > 75

A CTE-based listing shows how the prompted conversion and total-memory calculation can become executable SQL. section 10.6.2

How AI for Everyday IT covers it

How deep it goes
Explains column selection, unit conversion, conditional calculation, and redundancy reduction without detailing every SQL alternative.
Examples
Uses Oracle memory configuration columns, megabyte conversion, conditional totals, and CTE-based SQL.
What it assumes
Assumes awareness of the desired solution for direct instruction while remaining approachable for newcomers to prompting.
What you can do after
Apply it via concise chatbot prompts that specify transformations and conditional calculations.
How it connects
Connects pseudocode with chatbot prompting, SQL queries, database tables, token limits, and query redundancy.

Also explained in

Compare how 6 books explain pseudocode →

Related concepts

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