Asking for Tables and Structured Data
Request markdown tables and structured output for comparison tasks.
Tables as Output Format
Tables are one of the most useful AI output formats for comparative information. They make relationships between items scannable and allow quick side-by-side analysis.
The key to getting good tables: specify the exact column names, what each column should contain, and how many rows to include.
Basic Table Request
The standard pattern for requesting a markdown table:
'Format as a markdown table with columns: [Column1], [Column2], [Column3].'
Markdown tables render in GitHub, Notion, Obsidian, and most AI chat UIs. They use pipe characters to separate columns and dashes for header separators.
import openai
client = openai.OpenAI(api_key='sk-your-key-here')
response = client.chat.completions.create(
model='gpt-4o',
messages=[{
'role': 'user',
'content': (
'Compare Python, JavaScript, and Go for building REST APIs. '
'Format as a markdown table with columns: '
'Language, Performance, Learning Curve, Ecosystem, Best Use Case. '
'One row per language. Be concise — max 8 words per cell.'
)
}]
)
print(response.choices[0].message.content)All lessons in this course
- Requesting Lists and Bullet Points
- Asking for Tables and Structured Data
- Markdown Formatting in Prompts
- Plain Text vs Formatted Output