This is a quick article that describes what an ontology is and why ontologies are important.
What is an Ontology?
In data management, an ontology is a formal representation of knowledge that defines the concepts within a particular domain, their properties, and the relationships between them. It provides a shared understanding of what data means, how different entities relate to one another, and how systems can interpret those relationships consistently.
While a database schema defines how data is structured and stored, an ontology goes a step further by describing the meaning of the data and the rules governing its relationships.
What does an Ontology consist of?
An ontology typically consists of four key elements:
Entities or concepts: The things being described, such as Customers, Products, Orders, and Employees.
Properties: The characteristics of those concepts, such as a customer’s name, a product’s price, or an employee’s department.
Relationships: How concepts connect to one another, such as a Customer placing an Order or an Employee managing a Department.
Rules and constraints: Conditions that define how concepts behave or relate, such as an Order containing at least one Product.
Consider a retail business. Its ontology might define that a Customer places an Order, an Order contains Products, and each Product belongs to a Product Category. These relationships help systems understand the business beyond individual database tables.
Ontology vs. Data Model vs. Semantic Model vs. Knowledge Graph
Although these concepts are related, they serve different purposes.
Concept
Primary Purpose
Example
Data Model
Defines the structure and organization of data.
Customer and Order tables connected by a foreign key.
Ontology
Defines concepts, meanings, relationships, and rules within a domain.
A customer places an order, which contains products.
Semantic Model
Organizes data around business concepts, relationships, measures, and definitions to support consistent analysis and reporting.
A Power BI model connecting Customers, Products, and Sales, with a standardized Total Revenue measure.
Knowledge Graph
Represents entities and their relationships as connected data.
A graph showing customers, orders, products, and their connections.
An ontology can provide the semantic foundation for a knowledge graph, while a data model defines how information is organized in a particular system. A semantic model builds on data structures and business definitions to make information easier to query, analyze, and interpret consistently.
For example, a Power BI semantic model may define a standardized Revenue measure, establish relationships between sales and product tables, and organize fields into user-friendly business categories. An ontology could extend this understanding by formally defining what a Customer or Product represents and how those concepts relate across multiple business systems.
Why are Ontologies important?
Ontologies are increasingly valuable in modern data environments because they help organizations:
Improve data integration: Connect information across systems that use different structures or terminology.
Establish consistent business definitions: Ensure that concepts such as Customer, Revenue, or Active Account have a shared meaning.
Enable semantic search: Allow users and applications to find information based on meaning and relationships rather than just matching keywords.
Support artificial intelligence: Give AI systems structured domain knowledge that can help them interpret questions, identify relationships, and produce more contextually relevant responses.
Improve data discovery: Help analysts and business users understand how datasets and business concepts relate to one another.
For example, an AI assistant answering the question, “Which customers purchased products in our premium category?” could use an ontology to understand the relationships between customers, purchases, products, and product categories—even when the underlying information is distributed across multiple systems.
Ontologies and the future of data
As organizations adopt knowledge graphs, semantic models, and AI-powered applications, ontologies are becoming an important component of data architecture. They help bridge the gap between raw data and business meaning, allowing both people and machines to interpret information more consistently.
The key takeaway: A data model explains how data is organized, an ontology explains what the data represents and how its concepts relate, a semantic model makes data meaningful and usable for business analysis, and a knowledge graph represents entities and their relationships as connected information. Together, these concepts help organizations build more connected, intelligent, and AI-ready data environments.
This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub. This topic falls under these sections: Implement AI capabilities in database solutions (25–30%) --> Design and implement intelligent search --> Design for vector data, including vector data type, vector indexes, and size
Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.
Introduction
Modern AI-enabled applications increasingly rely on vector data to represent the meaning of text, images, audio, and other unstructured information. Instead of matching exact words, vector-based search enables applications to find content based on semantic similarity.
Microsoft SQL Server 2025, Azure SQL Database, and Azure SQL Managed Instance introduce native support for vector data, allowing databases to store embeddings directly alongside relational data. Combined with AI models and vector indexes, SQL databases become powerful platforms for semantic search, Retrieval-Augmented Generation (RAG), recommendation engines, document similarity, and AI assistants.
For the DP-800 exam, candidates should understand how to:
Design schemas that store vector embeddings
Choose appropriate vector dimensions
Understand vector data types
Create and maintain vector indexes
Balance storage, performance, and accuracy
Select index types appropriate for AI workloads
Understand how vector size affects database performance
What Is Vector Data?
A vector is a numerical representation of data generated by an embedding model.
Instead of storing text directly, the model converts text into hundreds or thousands of floating-point numbers.
Example:
Original text:
“Azure SQL supports AI-powered search.”
Embedding:
[0.012,
-0.553,
0.441,
...
0.318]
This numerical representation captures semantic meaning.
Documents discussing:
AI databases
Azure SQL
semantic search
will produce vectors located close together within vector space.
Why Store Vectors in SQL?
Traditionally, embeddings were stored in external vector databases.
Modern SQL databases now support vectors directly, allowing organizations to:
Keep structured and unstructured data together
Simplify architecture
Reduce synchronization complexity
Improve transactional consistency
Query relational and vector data simultaneously
Example table:
ProductID
Name
Category
Description
DescriptionEmbedding
101
Laptop
Electronics
Portable computer
Vector
This allows applications to perform:
SQL filtering
joins
semantic search
within one query.
Understanding the Vector Data Type
The new VECTOR data type stores embeddings efficiently inside SQL tables.
Example:
VECTOR(1536)
The number specifies the vector dimensions.
Examples:
VECTOR(768)
VECTOR(1024)
VECTOR(1536)
VECTOR(3072)
The dimension must exactly match the embedding model.
What Are Vector Dimensions?
Each embedding model outputs a fixed number of values.
Examples:
Model
Typical Dimensions
Small embedding model
768
text-embedding-3-small
1536
text-embedding-3-large
3072
If an embedding model generates 1536 values:
VECTOR(1536)
must be used.
Using the wrong size causes insert failures.
Choosing the Correct Vector Size
Higher dimensions provide richer semantic meaning.
However they also require:
more storage
larger indexes
slower searches
additional memory
Example comparison:
Dimensions
Characteristics
256
Very small, fast, lower accuracy
768
Good balance
1024
Higher quality
1536
Excellent semantic understanding
3072
Highest quality but larger storage
Choosing unnecessarily large vectors wastes storage.
How Embedding Size Affects Storage
Each dimension stores a floating-point number.
Example:
1536 dimensions
≈1536 floating point values
Across one million rows:
1,000,000 vectors
×
1536 dimensions
This becomes a significant storage requirement.
Large AI applications should estimate storage before deployment.
Designing Tables for Vector Data
Common design:
Documents
------------
DocumentID
Title
Category
Content
Embedding
The embedding column stores semantic meaning.
Other columns remain relational.
This design enables hybrid queries.
Separating Embeddings from Business Data
Many organizations separate embeddings into another table.
Example:
Documents
DocumentID
Title
Content
DocumentEmbeddings
DocumentID
Embedding
ModelVersion
CreatedDate
Benefits:
easier regeneration
reduced locking
independent maintenance
multiple embedding versions
Versioning Embeddings
Embedding models evolve.
Example:
Version 1:
text-embedding-3-small
Later:
text-embedding-3-large
A model change usually requires regenerating all vectors.
Many databases store:
Model Name
Version
Generation Date
This allows safe migrations.
One Embedding or Multiple?
Some applications store several embeddings.
Example:
Products
Title embedding
Description embedding
Review embedding
Different searches can target different meanings.
Designing for Chunk-Level Embeddings
Large documents are usually divided into chunks.
Instead of:
Entire PDF
↓
One vector
Applications store:
Document
↓
Paragraphs
↓
One vector per paragraph
Benefits include:
higher search precision
better RAG responses
smaller embeddings
improved relevance
Vector Search vs Traditional Search
Traditional search matches keywords.
Example:
Search:
vehicle
Document:
car
Keyword search may miss it.
Vector search recognizes semantic similarity.
It understands:
automobile
vehicle
car
SUV
are closely related.
Combining SQL Filters with Vector Search
One major benefit of SQL databases is combining structured filters with AI search.
Example:
Category = Electronics
AND
Vector similarity
Only electronics are searched semantically.
This improves both performance and relevance.
Exact Search vs Approximate Search
Vector searches generally use two approaches.
Exact Search
Compares every vector.
Advantages:
highest accuracy
Disadvantages:
slower
expensive for large datasets
Approximate Search
Uses specialized indexes.
Advantages:
much faster
scalable
Tradeoff:
slight reduction in accuracy
Most production AI systems use approximate search.
Understanding Vector Indexes
Without indexes:
Every vector must be compared.
1 million vectors
↓
1 million comparisons
Vector indexes dramatically reduce work.
They organize vectors based on similarity.
This enables very fast nearest-neighbor searches.
Approximate Nearest Neighbor (ANN)
Modern vector databases commonly use ANN indexing.
Instead of checking every vector:
Search
↓
Relevant region
↓
Nearby vectors
↓
Best matches
Response times become milliseconds instead of seconds.
Why Vector Indexes Matter
Benefits include:
faster semantic search
reduced CPU usage
scalable AI applications
improved RAG performance
lower query latency
Large AI systems depend heavily on vector indexing.
Choosing Whether to Create a Vector Index
Small datasets:
A vector index may not provide significant benefit.
Large datasets:
Vector indexes become essential.
Typical guidance:
Rows
Recommendation
Thousands
Optional
Hundreds of thousands
Recommended
Millions
Essential
Best Practices
Use the embedding dimensions required by the selected model.
Store vectors in dedicated VECTOR columns.
Keep relational data alongside embeddings whenever practical.
Separate embeddings into dedicated tables when frequent regeneration is expected.
Track embedding model versions.
Chunk large documents before generating embeddings.
Choose the smallest embedding model that delivers acceptable quality.
Create vector indexes for large datasets.
Combine relational filtering with semantic search.
Monitor storage growth as embeddings increase.
Common Exam Tips
Know that VECTOR stores embedding data.
Understand that vector dimensions must match the embedding model.
Remember that larger vectors increase storage and memory requirements.
Recognize that vector indexes accelerate semantic similarity searches.
Understand the difference between exact and approximate nearest-neighbor searches.
Know that chunking improves retrieval quality for large documents.
Understand that multiple embeddings may exist for a single record.
Remember that embedding model upgrades usually require regenerating vectors.
Understand that relational filtering and vector search can be combined.
Expect scenario-based questions involving storage, indexing, scalability, and AI search architecture.
Practice Exam Questions
Question 1
A company is building a Retrieval-Augmented Generation (RAG) application using Azure SQL Database. They plan to store embeddings generated by the text-embedding-3-small model.
Which VECTOR data type should be used for the embedding column?
Explanation: The text-embedding-3-small model generates 1,536-dimensional embeddings. The VECTOR column must match the number of dimensions produced by the embedding model. Using any other dimension would prevent embeddings from being stored correctly.
Question 2
A database contains 12 million product embeddings. Semantic searches are becoming increasingly slow because every query compares all vectors.
What should the database developer implement?
A. A clustered index on the VECTOR column B. A vector index that supports Approximate Nearest Neighbor (ANN) searches C. A nonclustered index on the product name D. A filtered index on the category column
Correct Answer: B
Explanation: Vector indexes using Approximate Nearest Neighbor algorithms dramatically reduce the number of comparisons required during similarity searches. Traditional SQL indexes cannot optimize vector similarity calculations.
Question 3
A developer must choose between a 768-dimensional embedding model and a 3,072-dimensional embedding model.
What is generally true about the larger embedding model?
A. It always performs searches faster. B. It requires fewer storage resources. C. It typically captures more semantic detail but requires additional storage and memory. D. It cannot be indexed.
Correct Answer: C
Explanation: Higher-dimensional embeddings generally preserve more semantic information, improving search quality. However, they increase storage requirements, memory consumption, and indexing costs.
Question 4
A database stores customer information together with vector embeddings representing customer support conversations.
Which design provides the greatest flexibility for regenerating embeddings after switching to a new embedding model?
A. Store embeddings in a separate table linked by the primary key. B. Store embeddings inside a JSON document. C. Store embeddings inside XML columns. D. Store embeddings inside temporary tables.
Correct Answer: A
Explanation: Separating embeddings into their own table simplifies regeneration, maintenance, versioning, and model migration while keeping business data unchanged.
Question 5
A development team wants to search only engineering documents while using semantic similarity.
Which approach best meets this requirement?
A. Perform only vector similarity searches across every document. B. Filter documents by department using SQL, then perform vector similarity searches. C. Disable relational filtering. D. Store engineering documents in a separate SQL Server instance.
Correct Answer: B
Explanation: One advantage of SQL databases is combining structured filtering with vector similarity search. Restricting the dataset before similarity comparisons improves both performance and relevance.
Question 6
A company stores embeddings for technical manuals that average 400 pages each.
What is the recommended design approach?
A. Generate one embedding for the entire manual. B. Store only the title as an embedding. C. Divide manuals into logical chunks and generate embeddings for each chunk. D. Generate embeddings only for images.
Correct Answer: C
Explanation: Chunking improves semantic retrieval accuracy by allowing searches to return only the most relevant portions of large documents rather than entire documents.
Question 7
A developer upgrades from one embedding model to another that produces vectors with a different number of dimensions.
What should the developer expect?
A. Existing vectors automatically resize. B. Existing vectors remain compatible without changes. C. SQL Server automatically converts vector dimensions. D. Existing embeddings must be regenerated to match the new model dimensions.
Correct Answer: D
Explanation: Embedding dimensions are fixed for each model. Changing models often changes vector size, requiring regeneration of all stored embeddings.
Question 8
An application contains approximately 3,000 embedded documents.
Which statement is most accurate regarding vector indexes?
A. Vector indexes are mandatory regardless of database size. B. Vector indexes cannot be created until at least one million vectors exist. C. A vector index may provide limited benefit for a very small dataset. D. Vector indexes only work with GraphQL.
Correct Answer: C
Explanation: Small datasets often perform adequately without vector indexes. The performance gains become much more significant as the number of vectors increases.
Question 9
A developer wants to support semantic search over product descriptions while maintaining product categories, prices, and inventory information in the same database.
Which database design best supports this objective?
A. Store embeddings in a VECTOR column while keeping relational attributes in standard SQL columns. B. Store all relational data inside embedding vectors. C. Replace relational tables with JSON files. D. Store embeddings only in application memory.
Correct Answer: A
Explanation: Keeping embeddings alongside relational data enables hybrid queries that combine SQL filtering with semantic similarity search, one of the major strengths of AI-enabled SQL databases.
Question 10
Which factor has the greatest impact on the storage requirements of vector data?
A. Database collation B. Number of database users C. Recovery model D. Number of dimensions in each embedding
Correct Answer: D
Explanation: Each embedding stores one numeric value per dimension. As the number of dimensions increases, the storage required for each vector grows proportionally, affecting table size, indexes, backups, and memory usage.
Final Exam Tips
Ensure the VECTOR column dimension exactly matches the embedding model.
Larger embeddings generally improve semantic quality but increase storage and computational costs.
Use vector indexes (ANN) for large datasets to improve search performance.
Combine relational SQL filtering with vector similarity searches for efficient hybrid queries.
Chunk large documents before generating embeddings to improve retrieval quality.
Store embedding model metadata and versions to simplify future migrations.
Separate embeddings from business data when frequent regeneration is expected.
This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub. This topic falls under these sections: Implement AI capabilities in database solutions (25–30%) --> Design and implement intelligent search --> Evaluate performance of vector and hybrid search
Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.
Introduction
Evaluating the performance of vector and hybrid search solutions is a critical responsibility when developing AI-enabled database applications. While implementing vector search is important, ensuring that the search solution consistently returns accurate, relevant, fast, and scalable results is equally essential. Database developers must understand how to measure search quality, optimize retrieval performance, balance latency with accuracy, and monitor search systems over time.
This knowledge is especially important for applications such as:
Retrieval-Augmented Generation (RAG)
Enterprise knowledge search
AI-powered chatbots
Document retrieval
Recommendation systems
Intelligent search applications
Why Performance Evaluation Matters
Unlike traditional SQL queries that typically return deterministic results, vector and hybrid search systems retrieve documents based on statistical similarity.
This means there is always a balance between:
Search speed
Search accuracy
Resource consumption
Scalability
A search system that responds instantly but returns irrelevant documents is not useful.
Likewise, a system that returns perfect results but requires several seconds per query may not satisfy user expectations.
The goal is to optimize the entire search experience.
Key Performance Metrics
Several metrics are commonly used to evaluate vector and hybrid search.
Query Latency
Latency measures how long a search takes to return results.
Example:
User Query
↓
120 ms
↓
Results Returned
Lower latency improves user experience.
Typical enterprise AI search systems aim for response times measured in milliseconds.
Factors affecting latency include:
Index type
Dataset size
Hardware resources
Number of search algorithms executed
Network latency
Number of retrieved documents
Throughput
Throughput measures the number of search requests a system can process within a given time.
Examples:
Searches per second
Queries per minute
Higher throughput enables more concurrent users.
Throughput depends on:
CPU
Memory
Index efficiency
Parallel processing
Database architecture
Recall
Recall measures how many relevant documents are successfully retrieved.
Example:
Relevant documents:
A
B
C
D
E
Returned documents:
A
B
C
X
Y
Recall:
3 / 5 = 60%
Higher recall generally improves RAG quality because more relevant information is available to the large language model.
Precision
Precision measures how many returned documents are actually relevant.
Example:
Returned:
A
B
C
X
Y
Relevant:
A
B
C
Precision:
3 / 5 = 60%
High precision reduces irrelevant search results.
F1 Score
The F1 Score combines precision and recall into a single metric.
It is especially useful when both false positives and false negatives matter.
Higher F1 scores indicate a better overall balance between retrieving relevant documents and avoiding irrelevant ones.
Mean Reciprocal Rank (MRR)
MRR measures how highly the first relevant result appears in the ranked list.
Example:
Relevant document positions:
Query
First Relevant Result
Query 1
Rank 1
Query 2
Rank 2
Query 3
Rank 4
Higher MRR indicates users find relevant information more quickly.
MRR is commonly used when evaluating question-answering systems and RAG applications.
Normalized Discounted Cumulative Gain (NDCG)
NDCG measures:
Ranking quality
Position of relevant documents
Graded relevance
Unlike recall, NDCG rewards placing the most relevant documents near the top.
This is especially important because users rarely read beyond the first few search results.
Evaluating Vector Search
When evaluating vector search, developers typically measure:
Recall
Precision
Latency
Index build time
Memory usage
Storage requirements
Index Performance
Questions include:
How quickly are searches completed?
How much memory does the index require?
How long does index creation take?
How efficiently are inserts handled?
Search Quality
Evaluate:
Are similar documents retrieved?
Are unrelated documents excluded?
Are synonyms recognized?
Does semantic similarity match user expectations?
Evaluating Hybrid Search
Hybrid search combines:
Full-text search
Vector search
Metadata filtering
Ranking algorithms such as Reciprocal Rank Fusion (RRF)
Optional semantic reranking
Because more components participate, additional evaluation is necessary.
Ranking Quality
Developers evaluate whether:
Exact matches appear near the top.
Semantically relevant documents are included.
Duplicate results are minimized.
Ranking is consistent.
Hybrid Relevance
Example query:
“Reduce Azure costs”
Good hybrid results may include:
Azure cost optimization
Cloud spending reduction
Budget management
Reserved capacity guidance
Poor hybrid results may include unrelated Azure topics.
Measuring Retrieval Quality
Many organizations create benchmark datasets.
Example:
Question:
“How do I configure VPN access?”
Expected documents:
VPN Setup Guide
Remote Access Policy
Authentication Configuration
The search system is evaluated based on whether these expected documents appear in the returned results.
Human Evaluation
Automated metrics cannot evaluate every aspect of search quality.
Organizations often perform manual reviews.
Experts examine:
Relevance
Completeness
Ranking quality
Consistency
Human evaluation is particularly valuable for RAG applications.
Offline Evaluation
Offline testing uses historical datasets.
Advantages:
Repeatable
Safe
Fast
No production impact
Developers compare:
Multiple embedding models
Index types
Similarity metrics
Ranking algorithms
Online Evaluation
Online evaluation uses live users.
Common techniques include:
A/B Testing
Group A:
Current search system
Group B:
New search implementation
Metrics compared include:
Click-through rate
User satisfaction
Search success
Session completion
User Feedback
Collect feedback such as:
Helpful
Not Helpful
User feedback helps improve future search tuning.
Factors Affecting Vector Search Performance
Embedding Quality
Poor embeddings reduce retrieval quality regardless of index performance.
Always choose embedding models appropriate for the domain.
Similarity Metric
Common choices:
Cosine similarity
Dot product
Euclidean distance
Using the wrong metric can reduce search accuracy.
Vector Index Type
Different index types provide different tradeoffs.
Index
Speed
Recall
Memory
Flat
Slow
Highest
Moderate
HNSW
Very Fast
Very High
High
IVF
Fast
High
Moderate
IVF + PQ
Very Fast
Moderate-High
Low
Candidate Set Size
Returning more candidate documents often increases recall.
However:
Latency increases.
More data must be reranked.
LLM token usage increases in RAG.
Balance is important.
Metadata Filtering
Filtering improves:
Precision
Latency
Example:
WHERE Department ='Finance'
Searching fewer documents reduces processing time while improving relevance.
Evaluating Hybrid Search Components
Keyword Search
Evaluate:
Exact matches
Phrase matching
Synonym handling
Technical terminology
Vector Search
Evaluate:
Semantic understanding
Related concepts
Context awareness
Reciprocal Rank Fusion (RRF)
Evaluate:
Ranking consistency
Combined relevance
Candidate diversity
Semantic Reranking
Evaluate:
Final ranking quality
User satisfaction
Response accuracy
Common Performance Bottlenecks
Missing Vector Index
Searching every embedding significantly increases latency.
Poor Embeddings
Weak embeddings reduce semantic quality.
Excessive Candidate Retrieval
Retrieving hundreds of documents unnecessarily increases reranking and LLM processing time.
Large Embedding Dimensions
Higher-dimensional embeddings require:
More storage
More memory
More computation
Frequent Index Rebuilds
Rebuilding indexes too frequently can consume unnecessary resources.
Use incremental updates where supported.
Optimization Techniques
Choose the Correct Index
Examples:
Small datasets → Flat
Medium datasets → HNSW
Very large datasets → IVF or IVF + PQ
Tune Candidate Count
Retrieve only the number of documents needed.
Use Metadata Filters
Reduce unnecessary searches.
Optimize Embeddings
Select high-quality embedding models.
Use Hybrid Search
Combining lexical and semantic search generally improves relevance.
Apply Semantic Reranking
Use reranking on a limited candidate set to improve final result quality.
Performance Monitoring
Production systems should monitor:
Average latency
Peak latency
Recall
Precision
Throughput
Memory usage
Index size
Search failures
User satisfaction
Search abandonment rate
Monitoring enables proactive tuning as data volumes and usage patterns evolve.
Best Practices
Benchmark search quality before deployment.
Measure both latency and retrieval quality.
Use benchmark datasets with known expected results.
Combine automated metrics with human evaluation.
Tune candidate retrieval size based on workload.
Select the appropriate vector index for dataset size.
Monitor production search metrics continuously.
Refresh embeddings when source data changes significantly.
Evaluate hybrid search using realistic business queries.
Test changes in a staging environment before production deployment.
DP-800 Exam Tips
Remember these key points for the exam:
Vector search performance should be evaluated using both speed and retrieval quality metrics.
Recall measures how many relevant documents are retrieved.
Precision measures how many returned documents are relevant.
MRR evaluates how quickly users encounter the first relevant result.
NDCG evaluates the quality of document ranking.
Hybrid search should be evaluated as a complete pipeline, including keyword search, vector search, RRF, and optional semantic reranking.
Metadata filtering improves both precision and performance.
Human evaluation remains important because automated metrics cannot fully measure search usefulness.
Production systems should continuously monitor latency, recall, throughput, and user satisfaction.
Practice Exam Questions
Question 1
A database developer is evaluating a vector search solution. Which metric measures the percentage of retrieved documents that are actually relevant?
A. Recall
B. Latency
C. Precision
D. Throughput
Answer: C
Explanation: Precision measures the proportion of retrieved documents that are relevant. High precision indicates that the search results contain few irrelevant documents.
Question 2
A Retrieval-Augmented Generation (RAG) application consistently retrieves only three of the five relevant documents for most user queries.
Which performance metric is primarily affected?
A. Recall
B. Mean Reciprocal Rank (MRR)
C. Throughput
D. Query latency
Answer: A
Explanation: Recall measures how many relevant documents are successfully retrieved. Missing relevant documents lowers the recall score.
Question 3
Which metric evaluates how quickly users encounter the first relevant search result?
A. F1 Score
B. Mean Reciprocal Rank (MRR)
C. Precision
D. Throughput
Answer: B
Explanation: MRR evaluates the ranking position of the first relevant result, rewarding systems that place useful documents near the top of the results list.
Question 4
A search solution returns highly relevant documents, but users complain that responses take several seconds.
Which performance metric should the development team investigate first?
A. Index build time
B. Storage utilization
C. Embedding dimension
D. Query latency
Answer: D
Explanation: Query latency measures the time required to return search results. High latency negatively impacts the user experience, even when retrieval quality is good.
Question 5
Which statement best describes hybrid search performance evaluation?
A. Only vector search accuracy needs to be measured.
B. Only keyword search latency matters.
C. Evaluation should include keyword search, vector search, ranking quality, and overall retrieval performance.
D. Performance is determined solely by embedding size.
Answer: C
Explanation: Hybrid search combines multiple retrieval methods, so developers should evaluate the complete search pipeline rather than a single component.
Question 6
A developer increases the number of candidate documents retrieved before semantic reranking.
What is the most likely tradeoff?
A. Lower latency and reduced memory usage
B. Higher recall but increased latency and reranking costs
C. Reduced recall with faster indexing
D. Elimination of vector indexing requirements
Answer: B
Explanation: Retrieving more candidate documents increases the likelihood of finding relevant information but also increases processing time, reranking effort, and LLM token usage.
Question 7
Why is human evaluation still valuable when assessing AI-powered search systems?
A. Automated metrics cannot fully measure user relevance and usefulness.
B. Human evaluation eliminates the need for benchmark datasets.
C. Human reviewers create vector indexes.
D. Human evaluation replaces latency testing.
Answer: A
Explanation: While automated metrics quantify retrieval quality, human reviewers can assess contextual relevance, completeness, and overall usefulness from a user perspective.
Question 8
Which optimization technique can improve both search precision and query performance?
A. Increasing embedding dimensions indefinitely
B. Removing vector indexes
C. Using metadata filtering to narrow the search scope
D. Returning every matching document
Answer: C
Explanation: Metadata filters reduce the number of candidate documents that must be searched, improving both relevance and performance.
Question 9
Which performance metric evaluates the overall quality of document ranking by giving more credit when highly relevant documents appear near the top of the results?
A. Recall
B. Precision
C. Throughput
D. Normalized Discounted Cumulative Gain (NDCG)
Answer: D
Explanation: NDCG measures ranking quality by considering both document relevance and the position of documents in the ranked results, rewarding systems that place the most relevant items first.
Question 10
A development team wants to compare two different embedding models before deploying a new search solution.
Which evaluation approach is most appropriate?
A. Online A/B testing only
B. Disable benchmarking and rely on production feedback
C. Conduct repeatable offline testing using benchmark datasets with expected search results
D. Measure only CPU utilization
Answer: C
Explanation: Offline benchmarking with known datasets enables developers to compare embedding models, similarity metrics, and indexing strategies safely and consistently before deploying changes to production.
This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub. This topic falls under these sections: Implement AI capabilities in database solutions (25–30%) --> Design and implement retrieval-augmented generation (RAG) --> Identify use cases for RAG
Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.
Introduction
Retrieval-Augmented Generation (RAG) is one of the most important architectural patterns in modern AI-enabled database applications. Rather than relying solely on the knowledge contained within a Large Language Model (LLM), RAG retrieves relevant information from trusted data sources at query time and supplies that information to the model before it generates a response.
For the DP-800 exam, you should understand when RAG is appropriate, which business problems it solves, its advantages and limitations, and the types of applications that benefit most from its use.
What Is Retrieval-Augmented Generation (RAG)?
Retrieval-Augmented Generation (RAG) is an AI architecture that combines:
Information retrieval
Vector search
Large Language Models (LLMs)
Instead of asking an LLM to answer a question solely from its training data, a RAG system first retrieves relevant information from a database, document repository, or knowledge base.
The retrieved information is then included in the prompt sent to the LLM.
The workflow looks like this:
User Question
│
▼
Generate Query Embedding
│
▼
Vector or Hybrid Search
│
▼
Retrieve Relevant Documents
│
▼
Build Prompt with Retrieved Context
│
▼
Large Language Model
│
▼
Grounded Response
This process enables the model to answer using current, organization-specific, and trusted information.
Why RAG Is Needed
LLMs have several limitations when used independently.
Responses may contain hallucinations (confident but incorrect information).
RAG addresses these limitations by retrieving external information before response generation.
For example:
Without RAG:
“What is our company’s parental leave policy?”
The LLM has no knowledge of an organization’s private HR documents.
With RAG:
The system retrieves the latest HR policy document and provides it to the LLM, enabling it to generate an accurate, grounded response.
When Should You Use RAG?
RAG is most valuable when answers depend on information that is:
Frequently updated
Organization-specific
Too large to include in prompts directly
Stored in databases or documents
Required to be accurate and traceable
Typical sources include:
SQL databases
Knowledge bases
PDFs
SharePoint libraries
Wikis
Product documentation
Policies
Support articles
Contracts
Technical manuals
Common Business Use Cases
1. Enterprise Knowledge Management
One of the most common RAG implementations is an internal knowledge assistant.
Employees can ask questions such as:
“How do I request family medical leave?”
The system retrieves HR documentation and generates a conversational answer.
Benefits include:
Faster information access
Reduced HR workload
Consistent answers
Always uses the latest documents
2. Customer Support
Support organizations often maintain thousands of troubleshooting articles.
Example question:
“Why won’t my VPN connect?”
Instead of requiring agents to manually search documentation, RAG retrieves relevant articles and generates a summarized answer.
Benefits:
Faster issue resolution
Improved customer satisfaction
Reduced training requirements
Consistent troubleshooting guidance
3. Technical Documentation Assistants
Software vendors publish extensive documentation.
Example:
“How do I configure Transparent Data Encryption?”
RAG retrieves:
Product documentation
Configuration guides
Best practices
The LLM produces a concise explanation grounded in the documentation.
4. SQL Database Assistants
Database developers may ask:
Explain this stored procedure.
Which table stores customer addresses?
Show the indexing strategy.
What permissions exist on this database?
A RAG system retrieves schema information, documentation, and metadata before generating responses.
5. Help Desk Automation
IT departments frequently answer repetitive questions.
Examples:
Password resets
VPN setup
Printer installation
Software installation
MFA enrollment
RAG enables intelligent self-service portals.
6. Legal Research
Law firms manage:
Contracts
Regulations
Case law
Internal legal guidance
RAG retrieves relevant documents before generating summaries.
Benefits:
Faster legal research
Improved consistency
Reduced manual searching
7. Healthcare Knowledge Systems
Healthcare organizations maintain:
Clinical guidelines
Treatment protocols
Internal procedures
RAG retrieves the latest guidance to support clinicians while ensuring answers are based on approved information.
8. Financial Services
Financial institutions use RAG for:
Compliance documentation
Regulatory guidance
Investment research
Internal policies
Because regulations change frequently, RAG provides more current information than relying solely on a model’s training data.
9. Product Recommendation Systems
Instead of searching manually through product catalogs:
Customer asks:
“I’m looking for a waterproof hiking backpack.”
RAG retrieves product specifications before the LLM generates recommendations.
10. Research Assistants
Researchers query:
Scientific papers
Internal reports
Publications
Technical documents
RAG retrieves relevant documents and summarizes findings.
Industry Examples
Industry
Example RAG Use Case
Healthcare
Clinical guideline assistant
Banking
Regulatory compliance assistant
Insurance
Policy document assistant
Manufacturing
Equipment maintenance assistant
Retail
Product recommendation assistant
Education
Course material assistant
Government
Citizen information portal
Legal
Contract and legal research assistant
Technology
Documentation chatbot
Human Resources
Employee policy assistant
When RAG Is NOT Necessary
RAG is not the best solution for every AI application.
Examples where RAG may not be required include:
Creative writing
Brainstorming ideas
Poetry generation
Fiction writing
General conversations
Language translation
Grammar correction
These tasks rely primarily on the language capabilities of the LLM rather than external knowledge.
RAG vs Fine-Tuning
A common exam topic is distinguishing RAG from fine-tuning.
RAG
Fine-Tuning
Retrieves external information
Modifies model weights
Uses current data
Learns from training data
No retraining required for document updates
Requires retraining for new knowledge
Best for dynamic information
Best for changing model behavior
Uses databases and documents
Uses training datasets
Example:
Company updates its vacation policy.
With RAG:
Simply update the knowledge base.
With fine-tuning:
The model would need to be retrained to incorporate the new policy.
Benefits of RAG
Current Information
Answers reflect the latest available documents.
Reduced Hallucinations
The LLM is grounded with trusted information before generating responses.
Organization-Specific Knowledge
Private business data remains outside the foundation model and is retrieved only when needed.
No Model Retraining
Updating documents updates the knowledge available to the system.
Better Accuracy
Responses are based on authoritative content rather than the model’s memory.
Explainability
Many RAG systems cite or link to the documents used to generate responses.
Limitations of RAG
Dependent on Retrieval Quality
Poor retrieval leads to poor responses.
Requires Search Infrastructure
Organizations must maintain:
Embeddings
Vector indexes
Search indexes
Metadata
Documents
Additional Latency
Searching for documents adds time before the LLM generates a response.
Token Limits
Too many retrieved documents may exceed the LLM’s context window.
Systems typically retrieve only the most relevant documents.
Selecting Good RAG Use Cases
Ideal RAG scenarios include:
Large document collections
Frequently changing information
Private organizational knowledge
Regulatory documentation
Technical documentation
Search-heavy workloads
Question-answering systems
Less suitable scenarios include:
Pure text generation
Entertainment applications
Creative storytelling
Static knowledge with no need for external sources
RAG in SQL-Based AI Solutions
Modern SQL platforms increasingly support capabilities that enable RAG solutions, including:
Vector data types
Embedding storage
Vector indexes
Hybrid search
Similarity search
Integration with Azure AI services
Secure access to structured and unstructured enterprise data
This allows developers to build AI applications that combine relational data with semantic search in a single solution.
Best Practices
Use RAG for applications requiring current or organization-specific information.
Build high-quality vector indexes and embeddings to improve retrieval accuracy.
Combine vector search with keyword search using hybrid search when appropriate.
Retrieve only the most relevant documents to stay within LLM context limits.
Apply security trimming so users retrieve only documents they are authorized to access.
Regularly update embeddings and indexes when source content changes.
Monitor retrieval quality using metrics such as precision, recall, and user feedback.
Include citations or source references whenever possible to increase trust.
DP-800 Exam Tips
Remember these key points for the exam:
RAG retrieves external information before the LLM generates a response.
RAG is ideal for organization-specific, frequently changing, or private knowledge.
RAG reduces hallucinations by grounding responses in retrieved documents.
RAG is commonly used with vector search and hybrid search.
RAG differs from fine-tuning because it does not modify the model’s weights.
Updating a knowledge base is typically sufficient to provide new information to a RAG system.
Common RAG use cases include enterprise search, customer support, technical documentation, compliance, and knowledge management.
Strong retrieval quality is essential because poor retrieval leads to poor AI responses.
Practice Exam Questions
Question 1
A company wants an AI assistant that answers employee questions using the latest HR policies stored in an internal document repository.
Which AI architecture is the most appropriate?
A. Fine-tune a language model every time a policy changes.
B. Use Retrieval-Augmented Generation (RAG).
C. Train a new embedding model monthly.
D. Use only keyword search without an LLM.
Answer: B
Explanation: RAG retrieves the latest HR documents at query time and provides them to the LLM, allowing responses to reflect current policies without retraining the model.
Question 2
Which scenario is the best candidate for implementing a RAG solution?
A. Generating original poetry
B. Creating fictional stories
C. Answering questions using frequently updated product documentation
D. Producing creative marketing slogans
Answer: C
Explanation: RAG excels when responses depend on current, external, or organization-specific information, such as product documentation that changes over time.
Question 3
Why does RAG generally reduce hallucinations compared to using an LLM alone?
A. It increases the model’s parameter count.
B. It permanently stores retrieved documents inside the model.
C. It grounds responses using relevant retrieved information.
D. It eliminates vector search.
Answer: C
Explanation: By providing the LLM with relevant documents before response generation, RAG enables the model to base its answers on trusted information instead of relying solely on its training data.
Question 4
A legal firm needs an AI assistant that answers questions using thousands of contracts and regulatory documents that change regularly.
Which solution is most appropriate?
A. Static prompting only
B. Fine-tuning only
C. Rule-based automation
D. Retrieval-Augmented Generation (RAG)
Answer: D
Explanation: RAG is well suited for dynamic document collections because updated documents become available to the AI system without requiring model retraining.
Question 5
Which statement correctly distinguishes RAG from fine-tuning?
A. RAG modifies the model’s internal weights.
B. Fine-tuning retrieves external documents during every query.
C. RAG retrieves external information at query time, while fine-tuning changes the model through additional training.
D. There is no practical difference between the two approaches.
Answer: C
Explanation: RAG supplements a model with retrieved context, whereas fine-tuning changes the model’s learned behavior through additional training.
Question 6
A company updates its employee handbook every month.
What is typically required for a RAG solution to use the latest information?
A. Retrain the large language model.
B. Replace the vector database.
C. Update the document repository, regenerate embeddings if needed, and refresh the search index.
D. Reinstall the AI application.
Answer: C
Explanation: RAG systems rely on current indexed content. When documents change, embeddings and indexes should be refreshed so the retrieval system can locate the updated information.
Question 7
Which use case is generally least appropriate for a RAG implementation?
A. Internal IT help desk assistant
B. Regulatory compliance assistant
C. Technical documentation chatbot
D. Creative short story generation
Answer: D
Explanation: Creative writing tasks primarily depend on the language generation capabilities of the model and typically do not require retrieval from external knowledge sources.
Question 8
A financial institution wants an AI solution that always references the latest compliance documents before answering user questions.
What is the primary advantage of using RAG?
A. It permanently stores compliance documents inside the LLM.
B. It enables responses based on current external documents without retraining the model.
C. It eliminates the need for search indexes.
D. It automatically fine-tunes the LLM after every document update.
Answer: B
Explanation: RAG retrieves current compliance documentation during each query, ensuring responses reflect the latest available information while avoiding repeated model retraining.
Question 9
Which technology is most commonly paired with RAG to retrieve semantically relevant documents?
A. Primary key indexes
B. Trigger-based replication
C. Vector search
D. Transaction log backups
Answer: C
Explanation: Vector search retrieves semantically similar documents using embeddings and is a foundational component of most modern RAG implementations.
Question 10
A database developer is evaluating potential AI projects.
Which project would benefit the most from a RAG architecture?
A. A calculator that performs arithmetic operations
B. A chatbot that answers questions using an organization’s internal SQL documentation and knowledge base
C. A utility that formats SQL code
D. A script that generates random passwords
Answer: B
Explanation: A chatbot that relies on organization-specific documentation is an ideal RAG use case because it requires access to current, trusted knowledge that is not contained within the LLM’s training data.
This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub. This topic falls under these sections: Implement AI capabilities in database solutions (25–30%) --> Design and implement retrieval-augmented generation (RAG) --> Identify use cases for RAG
Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.
Introduction
As SQL databases increasingly integrate with AI services, developers can call external REST APIs directly from Transact-SQL (T-SQL). One important capability is the sp_invoke_external_rest_endpoint system stored procedure, which enables SQL code to securely invoke REST endpoints, including AI services such as Azure AI Foundry models, Azure OpenAI Service, and other HTTP-based APIs.
For the DP-800 exam, you should understand how to use this stored procedure to build prompts, send requests to AI models, process responses, and incorporate Retrieval-Augmented Generation (RAG) workflows into SQL applications.
What Is sp_invoke_external_rest_endpoint?
sp_invoke_external_rest_endpoint is a system stored procedure that enables T-SQL code to invoke external REST APIs directly from supported SQL platforms, such as Azure SQL Database and SQL Server 2025 (where supported and configured).
Instead of requiring an application layer to call an external AI service, the database itself can send an HTTPS request and receive the response.
Typical workflow:
T-SQL
│
▼
sp_invoke_external_rest_endpoint
│
▼
REST API
│
▼
AI Model
│
▼
JSON Response
│
▼
SQL Processing
This capability allows SQL applications to integrate directly with AI-powered services while keeping business logic close to the data.
Why Use sp_invoke_external_rest_endpoint?
Many AI services expose REST APIs.
Examples include:
Azure OpenAI
Azure AI Foundry models
Azure AI Language
Azure AI Translator
Azure AI Vision
Custom REST APIs
Internal enterprise AI services
Using sp_invoke_external_rest_endpoint enables SQL developers to:
Include retrieved context to reduce hallucinations.
Responses from AI services are typically returned as JSON and can be parsed using SQL JSON functions.
Secure authentication is essential; avoid hard-coding credentials.
Minimize prompt size to improve performance and reduce token costs.
Practice Exam Questions
Question 1
A developer wants to call an Azure AI model directly from T-SQL without writing application code.
Which SQL capability enables this functionality?
A. sp_execute_external_script
B. OPENROWSET
C. sp_invoke_external_rest_endpoint
D. BULK INSERT
Answer: C
Explanation: sp_invoke_external_rest_endpoint enables supported SQL platforms to invoke external REST APIs directly from T-SQL, making it suitable for integrating AI services.
Question 2
In a Retrieval-Augmented Generation (RAG) solution, when is sp_invoke_external_rest_endpoint typically called?
A. Before documents are retrieved.
B. After relevant context has been retrieved and incorporated into the prompt.
C. Before embeddings are generated.
D. Before the vector index is created.
Answer: B
Explanation: In a typical RAG workflow, relevant documents are first retrieved using vector or hybrid search. The retrieved context is then included in the prompt before calling the LLM through the REST endpoint.
Question 3
Which HTTP method is most commonly used when invoking an AI chat completion REST endpoint?
A. GET
B. DELETE
C. PUT
D. POST
Answer: D
Explanation: AI inference requests generally send prompts and parameters within the request body, making POST the standard HTTP method.
Question 4
What is the primary benefit of including retrieved documents in the prompt sent to an AI model?
A. It permanently trains the language model.
B. It reduces network latency.
C. It grounds the response using relevant information.
D. It compresses the prompt.
Answer: C
Explanation: Including retrieved context allows the model to generate responses based on trusted information, improving accuracy and reducing hallucinations.
Question 5
Which SQL functionality is commonly used to extract generated text from a JSON response returned by an AI service?
A. JSON_VALUE
B. MERGE
C. PIVOT
D. ROW_NUMBER
Answer: A
Explanation: Functions such as JSON_VALUE, JSON_QUERY, and OPENJSON enable SQL developers to parse JSON responses returned by REST APIs.
Question 6
A developer is designing prompts for an AI-powered SQL assistant.
Which prompt design practice generally produces the most reliable responses?
A. Include unrelated historical data to provide additional context.
B. Keep prompts vague so the model has more flexibility.
C. Provide clear instructions and include only relevant retrieved context.
D. Omit the user’s question whenever possible.
Answer: C
Explanation: Clear instructions and focused, relevant context help the model generate accurate, grounded, and consistent responses.
Question 7
Which authentication approach is recommended when calling secured AI REST endpoints from SQL?
A. Store API keys directly in every stored procedure.
B. Use supported secure authentication mechanisms such as Microsoft Entra ID or managed identities where available.
C. Disable authentication during development and production.
D. Send credentials as query-string parameters.
Answer: B
Explanation: Secure authentication methods reduce the risk of credential exposure and align with security best practices for accessing external services.
Question 8
What is a common consequence of including excessive retrieved content in a prompt?
A. Lower token usage.
B. Faster inference times.
C. Reduced storage requirements.
D. Increased latency and higher token consumption.
Answer: D
Explanation: Longer prompts require more tokens to process, increasing inference time, cost, and the likelihood of exceeding the model’s context window.
Question 9
A database application receives an HTTP 429 response from an AI REST endpoint.
What does this response typically indicate?
A. The JSON response is malformed.
B. Authentication failed.
C. The request exceeded the service’s rate limit.
D. The endpoint only accepts GET requests.
Answer: C
Explanation: HTTP 429 (“Too Many Requests”) indicates that the client has exceeded the allowed request rate. Applications should implement appropriate retry strategies.
Question 10
Which sequence best represents a typical RAG workflow implemented from SQL?
B. Retrieve documents → Build prompt → Invoke sp_invoke_external_rest_endpoint → Parse the JSON response
C. Create vector index → Generate embeddings → Train the LLM
D. Build prompt → Delete vector index → Generate embeddings
Answer: B
Explanation: A typical SQL-based RAG workflow retrieves relevant documents, constructs a grounded prompt, invokes the external AI service using sp_invoke_external_rest_endpoint, and then parses the returned JSON response for use by the application.
This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub. This topic falls under these sections: Implement AI capabilities in database solutions (25–30%) --> Design and implement retrieval-augmented generation (RAG) --> Convert structured data to JSON for language model processing
Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.
Introduction
Modern AI-enabled database applications frequently need to send structured data stored in relational tables to Large Language Models (LLMs). Because LLMs interact with text or structured payloads such as JSON rather than relational tables, developers must transform SQL query results into JSON before sending them to AI services.
For the DP-800 exam, you should understand how to convert relational data into JSON using SQL, why JSON is the preferred interchange format for AI services, how JSON is used in Retrieval-Augmented Generation (RAG) workflows, and the best practices for preparing structured data for language model processing.
Why Convert Structured Data to JSON?
Relational databases organize information into:
Tables
Rows
Columns
Relationships
Large Language Models, however, consume:
Natural language
JSON documents
API payloads
Structured text
JSON (JavaScript Object Notation) provides a lightweight, hierarchical format that is easy for applications, APIs, and AI models to process.
Instead of sending an entire table, developers typically send only the relevant records formatted as JSON.
Role of JSON in AI Applications
JSON serves as the common data exchange format between SQL databases and AI services.
Typical workflow:
SQL Database
│
▼
Query Structured Data
│
▼
Convert to JSON
│
▼
Build AI Prompt
│
▼
REST API Request
│
▼
Large Language Model
│
▼
AI Response
This process allows structured business data to become part of an AI prompt or API request.
What Is JSON?
JSON is a text-based format consisting of key-value pairs and arrays.
Example:
{
"CustomerID":1001,
"CustomerName":"Contoso Ltd.",
"Country":"USA",
"CreditLimit":50000
}
Nested objects are also supported.
Example:
{
"OrderID":1055,
"Customer":{
"Name":"Contoso Ltd.",
"Country":"USA"
}
}
Hierarchical structures like these are easier for language models to interpret than tabular data.
Why AI Models Prefer JSON
JSON provides several advantages:
Human-readable
Machine-readable
Structured
Flexible
Widely supported
Easily serialized
Easily parsed
Most AI REST APIs accept JSON request bodies and return JSON responses.
Converting SQL Query Results to JSON
Modern SQL platforms support generating JSON directly from query results.
For example, SQL Server and Azure SQL Database provide the FOR JSON clause.
Example:
SELECT CustomerID,
CustomerName,
Country
FROM Customers
FOR JSON AUTO;
Sample output:
[
{
"CustomerID":1001,
"CustomerName":"Contoso Ltd.",
"Country":"USA"
},
{
"CustomerID":1002,
"CustomerName":"Fabrikam",
"Country":"Canada"
}
]
This JSON can be incorporated into prompts or REST API requests.
FOR JSON AUTO
FOR JSON AUTO automatically generates JSON based on the structure of the SELECT statement.
Advantages:
Minimal configuration
Quick generation
Good for simple queries
Example:
SELECT ProductID,
ProductName,
Price
FROM Products
FOR JSON AUTO;
FOR JSON PATH
FOR JSON PATH provides greater control over the resulting JSON structure.
Example:
SELECT
CustomerID AS'Customer.ID',
CustomerName AS'Customer.Name'
FOR JSON PATH;
Output:
[
{
"Customer":{
"ID":1001,
"Name":"Contoso Ltd."
}
}
]
FOR JSON PATH is preferred when a specific JSON schema is required by an application or AI service.
Creating Nested JSON
Nested JSON is useful for representing parent-child relationships.
Example:
Customer
↓
Orders
↓
Order Items
Instead of returning multiple unrelated tables, developers can build a hierarchical JSON document that mirrors the business object.
This format is often easier for an LLM to understand.
Using JSON in Prompts
Rather than embedding raw SQL results, developers can include JSON as structured context.
Example prompt:
Use the following customer information:
{
"CustomerID":1001,
"Name":"Contoso Ltd.",
"Country":"USA",
"CreditLimit":50000
}
Summarize the customer's profile.
The structured format enables the model to identify fields and values more reliably.
JSON in Retrieval-Augmented Generation (RAG)
In RAG applications, retrieved information often comes from:
SQL queries
Vector search
Hybrid search
APIs
Structured query results can be converted to JSON before being added to the prompt.
Workflow:
SQL Query
│
▼
FOR JSON
│
▼
Prompt Construction
│
▼
LLM
│
▼
Grounded Response
Combining Structured and Unstructured Data
Many AI applications combine relational data with documents.
Example:
Structured data:
{
"OrderID":1055,
"Status":"Shipped"
}
Retrieved documentation:
Orders typically arrive within three business days after shipment.
Prompt:
Order Information:
{
"OrderID":1055,
"Status":"Shipped"
}
Documentation:
Orders typically arrive within three business days.
Answer the customer's question.
This approach gives the LLM access to both factual business data and supporting context.
Reducing Token Usage
Large JSON payloads increase:
Prompt size
Latency
API cost
Token consumption
Best practice:
Include only relevant fields.
Instead of:
{
"CustomerID":1001,
"Name":"Contoso",
"Country":"USA",
"Phone":"...",
"Fax":"...",
"CreatedDate":"...",
"LastLogin":"...",
...
}
Use:
{
"CustomerID":1001,
"Country":"USA",
"CreditLimit":50000
}
Only include information required to answer the user’s question.
Security Considerations
Before converting SQL data to JSON:
Remove sensitive columns.
Exclude personally identifiable information (PII) unless required and authorized.
Apply row-level security (RLS).
Enforce column-level permissions.
Mask confidential values when appropriate.
Validate user authorization before retrieving data.
AI models should receive only the data necessary to perform the requested task.
Data Quality Considerations
Language model responses are only as good as the input data.
Ensure that:
Missing values are handled appropriately.
Duplicate rows are removed.
Invalid records are excluded.
Data types are consistent.
Field names are meaningful.
JSON is well-formed and valid.
Poor-quality JSON often leads to inaccurate or confusing AI responses.
Processing AI Responses
Most AI services also return JSON.
Example:
{
"summary":
"Contoso Ltd. is a U.S. customer with a credit limit of $50,000."
}
SQL JSON functions such as:
JSON_VALUE
JSON_QUERY
OPENJSON
can extract values from the response for further processing or storage.
Common Mistakes
Sending Entire Tables
Avoid sending unnecessary rows.
Instead:
Retrieve only relevant records.
Including Too Many Columns
Large prompts increase token usage and cost.
Using Poor Field Names
Prefer:
CustomerName
instead of:
C_Name
Clear field names help improve model understanding.
Ignoring Security
Never expose confidential information unnecessarily.
Creating Invalid JSON
Malformed JSON causes REST API failures and prevents AI services from processing requests.
Best Practices
Use FOR JSON AUTO for simple JSON generation.
Use FOR JSON PATH when custom JSON structures are required.
Return only relevant rows and columns.
Keep JSON concise to reduce token consumption.
Use meaningful field names.
Remove confidential or unnecessary information.
Validate JSON before sending it to AI services.
Combine structured JSON with retrieved documents for RAG scenarios.
Parse AI responses using SQL JSON functions.
Test prompts using realistic business data.
DP-800 Exam Tips
Remember these key points for the exam:
JSON is the standard format for exchanging structured data with AI services.
SQL Server and Azure SQL Database support JSON generation using FOR JSON.
FOR JSON AUTO automatically formats query results.
FOR JSON PATH provides greater control over JSON structure.
RAG solutions often include JSON generated from SQL queries as contextual information.
Smaller, focused JSON payloads reduce token usage and improve performance.
Protect sensitive information before converting data to JSON.
SQL JSON functions can parse AI responses returned as JSON.
Practice Exam Questions
Question 1
A database developer needs to send customer records from SQL Server to a Large Language Model through a REST API.
Which format is most appropriate?
A. XML
B. CSV
C. JSON
D. Binary data
Answer: C
Explanation: JSON is the standard format accepted by most AI REST APIs because it is lightweight, structured, and easy for both applications and language models to process.
Question 2
Which SQL clause automatically converts query results into JSON using the default structure of the SELECT statement?
A. FOR JSON AUTO
B. FOR XML
C. OPENJSON
D. JSON_VALUE
Answer: A
Explanation: FOR JSON AUTO automatically generates JSON based on the query structure with minimal configuration.
Question 3
A developer needs complete control over the hierarchy and property names in the generated JSON document.
Which SQL feature should be used?
A. FOR XML
B. FOR JSON PATH
C. JSON_QUERY
D. OPENJSON
Answer: B
Explanation: FOR JSON PATH allows developers to customize the JSON structure, including nested objects and property names.
Question 4
Why is JSON commonly used when interacting with Large Language Models?
A. It permanently stores embeddings.
B. It replaces vector indexes.
C. It provides a structured, machine-readable format that AI services commonly accept.
D. It automatically encrypts database records.
Answer: C
Explanation: JSON is widely supported by REST APIs and AI services, making it the preferred format for exchanging structured data.
Question 5
In a Retrieval-Augmented Generation (RAG) solution, why might structured SQL query results be converted to JSON?
A. To include structured business data as context in the prompt sent to the language model.
B. To train the language model.
C. To replace vector embeddings.
D. To eliminate REST APIs.
Answer: A
Explanation: Structured SQL data converted to JSON can be included in the prompt, allowing the LLM to generate grounded responses using current business information.
Question 6
A developer includes every column from a customer table in the JSON payload, even though only two fields are required.
What is the most likely consequence?
A. Improved retrieval accuracy.
B. Lower API costs.
C. Increased prompt size, token consumption, and latency.
D. Automatic JSON compression.
Answer: C
Explanation: Sending unnecessary data increases the size of the prompt, which leads to higher token usage, longer response times, and increased cost.
Question 7
Which SQL functions are commonly used to extract values from a JSON response returned by an AI service?
A. ROW_NUMBER and MERGE
B. JSON_VALUE, JSON_QUERY, and OPENJSON
C. PIVOT and UNPIVOT
D. STRING_AGG and GROUP BY
Answer: B
Explanation: SQL Server provides JSON functions such as JSON_VALUE, JSON_QUERY, and OPENJSON for parsing JSON documents and extracting data.
Question 8
Which practice best improves both security and efficiency when preparing JSON for an AI service?
A. Include every available database column.
B. Return the entire table regardless of the user’s request.
C. Remove unnecessary and sensitive information before generating JSON.
D. Convert the JSON into XML before sending it.
Answer: C
Explanation: Limiting the JSON payload to only necessary, authorized data reduces token usage, improves performance, and protects sensitive information.
Question 9
What is the primary advantage of using nested JSON structures?
A. They reduce the need for SQL joins.
B. They represent hierarchical relationships in a format that is easier for applications and language models to interpret.
C. They automatically generate embeddings.
D. They eliminate the need for REST APIs.
Answer: B
Explanation: Nested JSON naturally represents parent-child relationships, making complex business objects easier for both applications and AI models to process.
Question 10
A database application receives a JSON response from an AI service.
What is the next step if the application needs to store the generated summary in a SQL table?
A. Convert the JSON to XML.
B. Rebuild the vector index.
C. Parse the JSON response using SQL JSON functions and extract the required value.
D. Generate new embeddings for the response.
Answer: C
Explanation: After receiving a JSON response, SQL functions such as JSON_VALUE or OPENJSON can extract the generated content for storage or further processing.
This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub. This topic falls under these sections: Implement AI capabilities in database solutions (25–30%) --> Design and implement retrieval-augmented generation (RAG) --> Send results to a language model
Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.
Introduction
One of the final steps in a Retrieval-Augmented Generation (RAG) workflow is sending retrieved data to a Large Language Model (LLM). After retrieving relevant information from a SQL database, vector index, or hybrid search system, the application packages the data into a prompt and submits it to an AI model through a REST API. The quality of this process directly affects the accuracy, relevance, security, and efficiency of the generated response.
For the DP-800 exam, you should understand how to prepare retrieved results for language model processing, construct effective prompts, submit requests to AI services, handle responses, and follow best practices for security, performance, and reliability.
Where This Step Fits in a RAG Workflow
A Retrieval-Augmented Generation solution consists of several stages.
User Question
│
▼
Generate Query Embedding
│
▼
Vector or Hybrid Search
│
▼
Retrieve Relevant Documents
│
▼
Prepare Context
│
▼
Build Prompt
│
▼
Send Request to Language Model
│
▼
Receive AI Response
│
▼
Return Answer to User
Sending the retrieved results to the language model is the bridge between the retrieval system and the AI model.
Why Send Retrieved Results?
Large Language Models do not automatically have access to:
SQL databases
Internal documentation
Company policies
Product catalogs
Customer records
Knowledge bases
Instead, developers retrieve the necessary information and include it in the prompt sent to the model.
This process grounds the AI response in trusted, current information.
Components of a Request
A typical request sent to a language model includes several elements.
System Instructions
The system message defines the model’s role and behavior.
Example:
You are an expert SQL database assistant.
Answer only using the supplied context.
System instructions establish the rules the model should follow.
Retrieved Context
The retrieved context contains the information found during vector or hybrid search.
Example:
Document:
Clustered indexes physically store rows according to the index key.
Only relevant context should be included.
User Question
The original user request is included.
Example:
Why do clustered indexes improve query performance?
The language model combines the retrieved context with the user question to generate an answer.
Output Instructions
Developers may specify:
Response length
Formatting
Tone
JSON output
Markdown output
Bullet lists
Example:
Provide a concise answer in three bullet points.
Preparing Retrieved Results
Retrieved documents often require preprocessing before being sent to the model.
Common preprocessing tasks include:
Removing duplicate documents
Eliminating irrelevant information
Trimming excessively long content
Combining related results
Filtering unauthorized information
Formatting structured data as JSON when appropriate
Proper preparation improves both response quality and efficiency.
Selecting Relevant Context
Sending too much information can reduce answer quality and increase cost.
Best practice:
Retrieve only the top-ranking documents.
For example:
Instead of sending:
50 documents
Send:
Top 3–10 highly relevant documents
The exact number depends on the application’s requirements and the model’s context window.
Structuring the Prompt
A well-organized prompt improves response quality.
A common structure is:
System Instructions
Retrieved Context
User Question
Expected Response Format
Example:
You are a SQL expert.
Context:
Clustered indexes physically organize table rows according to the key.
Question:
Why do clustered indexes improve query performance?
Answer only using the provided context.
Sending Structured Data
Sometimes the retrieved information is relational data rather than documents.
Example SQL output:
Customer
Country
Credit Limit
Contoso
USA
50000
Instead of sending the table directly, developers often convert it to JSON.
Example:
{
"Customer":"Contoso",
"Country":"USA",
"CreditLimit":50000
}
JSON provides a structured format that AI services process efficiently.
Calling the Language Model
Most AI services expose REST APIs.
A request typically includes:
HTTPS endpoint
HTTP POST method
Authentication
JSON payload
Conceptually:
Prompt
↓
JSON Request
↓
REST API
↓
Language Model
↓
JSON Response
SQL Server and Azure SQL Database can call supported REST endpoints using the sp_invoke_external_rest_endpoint stored procedure where available.
SQL applications can extract the generated text using JSON functions such as:
JSON_VALUE
JSON_QUERY
OPENJSON
The application can then display, store, or further process the generated response.
Managing Context Windows
Every language model has a maximum context window.
The context window includes:
System instructions
Retrieved documents
User question
Previous conversation
Generated response
If too much information is included, requests may fail or important information may be truncated.
Developers should:
Remove irrelevant content.
Retrieve fewer documents.
Summarize long documents.
Limit prompt size.
Token Usage
Language models process text as tokens.
More retrieved content means:
More input tokens
Longer inference time
Higher API costs
Increased latency
Reducing unnecessary context improves both performance and cost efficiency.
Security Considerations
Developers should never send sensitive information unnecessarily.
Examples include:
Passwords
Authentication secrets
Personal identifiers
Confidential financial records
Protected health information
Internal security credentials
Before sending data to an external AI service:
Apply row-level security (RLS).
Apply column-level security.
Remove confidential fields.
Mask sensitive values when appropriate.
Verify user authorization.
Grounding the Response
One of the primary goals of RAG is grounding.
Grounding means that the model bases its answer on retrieved information rather than relying solely on its internal training.
Example instruction:
Answer only using the supplied documents.
If the answer is unavailable, say you do not know.
This helps reduce hallucinations.
Handling Errors
Common issues include:
Authentication Failures
Examples:
Expired tokens
Invalid credentials
Missing permissions
Network Problems
Examples:
Endpoint unavailable
Timeouts
DNS failures
Rate Limits
AI services may return:
429 Too Many Requests
Applications should implement retry logic using exponential backoff.
Invalid Requests
Examples:
Malformed JSON
Missing prompt
Unsupported parameters
Performance Considerations
Factors affecting performance include:
Prompt size
Number of retrieved documents
Network latency
AI model size
Token count
Response length
Concurrent requests
Performance can often be improved by:
Sending fewer documents.
Using concise prompts.
Removing duplicate information.
Optimizing retrieval quality.
Common Mistakes
Sending Irrelevant Documents
The language model may generate inaccurate or confusing responses.
Including Entire Database Records
Large prompts increase token usage and cost.
Poor Prompt Design
Ambiguous instructions often produce inconsistent responses.
Ignoring Security
Sensitive information should never be included unless necessary and authorized.
Missing Grounding Instructions
Without guidance, the model may rely on general knowledge instead of retrieved context.
Best Practices
Retrieve only the most relevant documents.
Use clear system instructions.
Include the user’s original question.
Organize prompts consistently.
Limit prompt size to reduce token usage.
Convert structured data to JSON when appropriate.
Remove sensitive information before sending requests.
Validate JSON payloads.
Monitor latency and token consumption.
Evaluate AI responses for accuracy and relevance.
Real-World Example
A company stores warranty information in SQL Server.
Workflow:
Customer asks:”Is my laptop still under warranty?”
SQL retrieves:
Product: X500
Purchase Date: January 10, 2025
Warranty: 2 Years
JSON is generated:
{
"Product":"X500",
"PurchaseDate":"2025-01-10",
"Warranty":"2 Years"
}
Prompt sent to the language model:
Use the following warranty information:
{
"Product":"X500",
"PurchaseDate":"2025-01-10",
"Warranty":"2 Years"
}
Answer whether the warranty is still valid.
The language model generates a grounded response using the supplied business data.
DP-800 Exam Tips
Remember these key points for the exam:
Sending results to the language model is the final step before AI response generation in a RAG workflow.
Retrieved documents should be relevant, concise, and properly formatted.
System instructions help guide model behavior.
Structured SQL data is often converted to JSON before being included in prompts.
Smaller prompts reduce latency and token costs.
Grounding instructions help reduce hallucinations.
Responses from AI services are typically returned as JSON.
Sensitive information should be removed before sending requests to external AI services.
Practice Exam Questions
Question 1
A developer is building a Retrieval-Augmented Generation (RAG) application.
After retrieving relevant documents from a vector search, what is the next logical step?
A. Send the retrieved context to the language model as part of the prompt.
B. Retrain the language model.
C. Rebuild the vector index.
D. Delete duplicate embeddings.
Answer: A
Explanation: After retrieval, the relevant documents are incorporated into the prompt and sent to the language model so it can generate a grounded response.
Question 2
Why should retrieved documents be included in a prompt sent to a language model?
A. To permanently update the model’s training data.
B. To ground the model’s response using relevant information.
C. To reduce embedding dimensions.
D. To replace vector indexes.
Answer: B
Explanation: Including retrieved context enables the model to generate responses based on current, authoritative information rather than relying solely on pre-trained knowledge.
Question 3
Which prompt component defines the behavior the language model should follow?
A. Retrieved context
B. User question
C. System instructions
D. JSON response
Answer: C
Explanation: System instructions establish the role, behavior, and constraints for the language model, such as answering only from the supplied context.
Question 4
A developer sends fifty retrieved documents to a language model, even though only five are relevant.
What is the most likely consequence?
A. Improved grounding accuracy.
B. Reduced API costs.
C. Faster inference.
D. Increased token usage, latency, and potential reduction in response quality.
Answer: D
Explanation: Including excessive context increases prompt size, consumes more tokens, raises costs, and may dilute the relevance of the information presented to the model.
Question 5
Which format is commonly used to send structured SQL query results to a language model?
A. Binary
B. XML
C. JSON
D. CSV
Answer: C
Explanation: JSON is the standard format for exchanging structured data with AI services because it is lightweight, hierarchical, and widely supported.
Question 6
What is the primary purpose of grounding instructions such as “Answer only using the supplied context”?
A. Increase the embedding dimension.
B. Reduce hallucinations by limiting the model to retrieved information.
C. Eliminate authentication requirements.
D. Automatically compress prompts.
Answer: B
Explanation: Grounding instructions encourage the model to base its responses on the retrieved documents instead of relying on unsupported assumptions or prior training.
Question 7
A language model returns its response as JSON.
Which SQL functions can be used to extract the generated answer?
A. MERGE and GROUP BY
B. ROW_NUMBER and RANK
C. STRING_AGG and PIVOT
D. JSON_VALUE, JSON_QUERY, and OPENJSON
Answer: D
Explanation: SQL Server provides JSON functions that allow applications to parse AI responses and extract specific values from JSON documents.
Question 8
Which security practice is most appropriate before sending retrieved results to an external AI service?
A. Include every available column to maximize context.
B. Remove sensitive or unauthorized information from the retrieved data.
C. Disable row-level security.
D. Send authentication credentials within the prompt.
Answer: B
Explanation: Only the information necessary for the AI task should be sent. Sensitive data should be removed or masked, and normal security controls should remain in effect.
Question 9
Why is prompt size an important consideration when sending results to a language model?
A. Larger prompts always improve response quality.
B. Prompt size has no effect on AI services.
C. Larger prompts increase token usage, cost, and response latency.
D. Prompt size determines the embedding algorithm.
Answer: C
Explanation: Every token contributes to processing time and cost. Keeping prompts concise improves performance while reducing API expenses.
Question 10
A company wants an AI assistant to answer questions using current warranty information stored in SQL Server.
Which approach best supports this requirement?
A. Fine-tune the language model every time warranty records change.
B. Store warranty records directly inside the model.
C. Build a RAG workflow that retrieves the current warranty data, formats it appropriately, and sends it to the language model.
D. Disable retrieval and rely only on the model’s training data.
Answer: C
Explanation: A RAG solution retrieves current business data at query time, formats it (often as JSON), and sends it to the language model, allowing responses to remain accurate without requiring model retraining.
This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub. This topic falls under these sections: Implement AI capabilities in database solutions (25–30%) --> Design and implement retrieval-augmented generation (RAG) --> Extract language model responses
Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.
Introduction
After a Large Language Model (LLM) generates a response, database applications must extract the returned content so it can be displayed to users, stored in the database, or used by downstream processes. Because most AI services return results in JSON format, developers must understand how to parse JSON, extract relevant values, handle errors, validate responses, and integrate the output into SQL-based applications.
For the DP-800 exam, you should understand the structure of language model responses, how to extract values using SQL JSON functions, how to handle different response formats, and the best practices for securely and efficiently processing AI-generated output.
Where Response Extraction Fits in a RAG Workflow
Extracting the language model response is one of the final stages in a Retrieval-Augmented Generation (RAG) pipeline.
User Question
│
▼
Retrieve Relevant Documents
│
▼
Build Prompt
│
▼
Send Request to AI Model
│
▼
Receive JSON Response
│
▼
Extract Generated Content
│
▼
Display or Store Results
Without response extraction, the application cannot effectively use the AI-generated answer.
Why AI Responses Are Returned as JSON
Most AI services expose REST APIs.
REST APIs typically exchange data using JSON because it is:
Lightweight
Human-readable
Machine-readable
Widely supported
Easy to parse
Whether using Azure AI Foundry models, Azure OpenAI Service, or other AI providers, JSON is the standard response format.
Typical Language Model Response
Although the exact schema varies by provider and API version, chat completion APIs commonly return a structure similar to the following:
{
"choices":[
{
"message":{
"role":"assistant",
"content":"Clustered indexes improve performance because the table rows are stored in key order."
}
}
]
}
The application typically extracts only the generated text, while ignoring metadata unless it is needed for monitoring or diagnostics.
Common Elements in AI Responses
A language model response may include:
Generated text
Response identifier
Model name
Completion reason
Token usage statistics
Timestamps
Metadata
Example (simplified):
{
"id":"chatcmpl-123",
"model":"gpt-4.1",
"choices":[
{
"message":{
"content":"Answer text..."
},
"finish_reason":"stop"
}
],
"usage":{
"prompt_tokens":125,
"completion_tokens":38,
"total_tokens":163
}
}
Developers often extract both the generated answer and token usage for logging or cost monitoring.
Parsing JSON in SQL
SQL Server and Azure SQL Database provide built-in JSON functions.
The most commonly used are:
JSON_VALUE
JSON_QUERY
OPENJSON
These functions enable developers to retrieve values from JSON returned by an AI service.
Using JSON_VALUE
JSON_VALUE extracts a single scalar value.
Example:
SELECT JSON_VALUE(@Response,
'$.choices[0].message.content');
Result:
Clustered indexes improve performance because...
This is the most common method for retrieving the generated response.
Using JSON_QUERY
JSON_QUERY extracts JSON objects or arrays.
Example:
SELECT JSON_QUERY(@Response,
'$.choices');
This returns the complete choices array rather than a single value.
Use JSON_QUERY when you need an entire object or array for further processing.
Using OPENJSON
OPENJSON converts JSON into relational rows and columns.
Example:
SELECT*
FROM OPENJSON(@Response,'$.choices');
This is useful when:
Multiple completions are returned
Arrays must be processed
Nested JSON must be flattened
Extracting Token Usage
Many AI services report token consumption.
Example:
{
"usage":{
"prompt_tokens":125,
"completion_tokens":40,
"total_tokens":165
}
}
Developers can extract these values.
Example:
SELECT JSON_VALUE(@Response,
'$.usage.total_tokens');
Tracking token usage helps monitor:
API costs
Performance
Resource consumption
Processing Multiple Choices
Some APIs may return multiple candidate responses.
Example:
{
"choices":[
{"message":{"content":"Option 1"}},
{"message":{"content":"Option 2"}}
]
}
Developers can use OPENJSON to iterate through the array and select the preferred response.
Storing AI Responses
Generated responses may be:
Displayed to users
Saved to SQL tables
Logged for auditing
Indexed for future retrieval
Used by downstream workflows
Example table:
RequestID
UserQuestion
AIResponse
DateGenerated
Proper storage supports auditing, analytics, and troubleshooting.
Validating Responses
Applications should validate AI responses before using them.
Check for:
Missing content
Empty responses
Malformed JSON
Unexpected schema
API errors
Validation improves application reliability.
Handling API Errors
Not every REST call succeeds.
Possible errors include:
Authentication Failure
Examples:
Invalid token
Expired credentials
Network Errors
Examples:
Timeout
DNS failure
Connection failure
Invalid Request
Examples:
Malformed JSON
Missing prompt
Unsupported parameters
Rate Limiting
Example:
429 Too Many Requests
Applications should implement retry logic using exponential backoff where appropriate.
Finish Reasons
Many chat completion APIs include a finish reason.
Examples:
stop
length
content_filter
Meaning:
Finish Reason
Description
stop
Normal completion
length
Maximum token limit reached
content_filter
Response filtered by safety system
Applications may use this information to determine whether a response is complete.
Processing Structured Output
Some prompts request JSON output rather than plain text.
Example response:
{
"summary":"Order shipped.",
"priority":"High"
}
SQL JSON functions can extract each property individually.
Example:
SELECT JSON_VALUE(@Response,
'$.summary');
Structured outputs are particularly useful for workflow automation.
Security Considerations
When processing AI responses:
Validate all returned data.
Do not assume responses are always correct.
Avoid executing generated SQL without validation.
Protect sensitive information.
Log responses securely.
Apply least-privilege access controls.
Even trusted AI services should be treated as external systems whose outputs require validation.
Performance Considerations
Large responses require:
More network bandwidth
More parsing time
More storage
More tokens
Developers should:
Limit response length where appropriate.
Extract only required fields.
Avoid storing unnecessary metadata.
Archive logs according to retention policies.
Common Mistakes
Assuming Every Response Has the Same Schema
Different AI services and API versions may return different JSON structures.
Ignoring Errors
Applications should always check for API failures before attempting to parse the response.
Parsing Entire JSON Documents
Extract only the required values to improve efficiency.
Not Validating Responses
Malformed or incomplete responses should be handled gracefully.
Ignoring Token Usage
Monitoring token consumption helps control costs.
Best Practices
Parse responses using SQL JSON functions.
Use JSON_VALUE for scalar values.
Use JSON_QUERY for objects and arrays.
Use OPENJSON for arrays and complex JSON.
Validate response schemas before processing.
Log errors separately from successful responses.
Track token usage for monitoring and optimization.
Limit stored data to what is necessary.
Handle rate limits and transient failures gracefully.
Design applications to tolerate API schema changes when possible.
The extracted summary is displayed to the support agent and optionally stored for future reference.
DP-800 Exam Tips
Remember these key points for the exam:
Most language model APIs return JSON responses.
JSON_VALUE extracts individual scalar values.
JSON_QUERY retrieves JSON objects or arrays.
OPENJSON converts JSON arrays and objects into relational data.
Applications should validate AI responses before using them.
Token usage information helps monitor API costs.
Finish reasons indicate how the model completed generation.
Handle API errors, rate limits, and malformed responses gracefully.
Store only the data needed for business purposes.
AI-generated output should always be treated as data that requires validation before use.
Practice Exam Questions
Question 1
A SQL application receives a JSON response from a language model and needs to extract the generated answer.
Which SQL function is most appropriate for retrieving a single text value?
A. JSON_VALUE
B. JSON_QUERY
C. OPENJSON
D. STRING_SPLIT
Answer: A
Explanation: JSON_VALUE extracts a single scalar value from a JSON document, making it ideal for retrieving the generated response text.
Question 2
A developer wants to retrieve the entire choices array from a language model response.
Which SQL function should be used?
A. ROW_NUMBER
B. JSON_QUERY
C. MERGE
D. JSON_VALUE
Answer: B
Explanation: JSON_QUERY returns JSON objects or arrays rather than individual scalar values, making it appropriate for extracting the complete choices array.
Question 3
When is OPENJSON most useful?
A. When extracting a single property value.
B. When converting JSON arrays into relational rows and columns.
C. When generating embeddings.
D. When creating vector indexes.
Answer: B
Explanation: OPENJSON parses JSON arrays and objects into tabular data that can be queried using SQL.
Question 4
Why should applications validate AI responses before using them?
A. JSON responses are always encrypted.
B. Validation reduces database storage requirements.
C. AI responses may be malformed, incomplete, or contain unexpected structures.
D. Validation automatically reduces token usage.
Answer: C
Explanation: Applications should verify that responses are valid, complete, and conform to the expected schema before processing them.
Question 5
A developer wants to monitor AI service costs.
Which information should be extracted from the response?
A. The database transaction log.
B. Vector dimensions.
C. Token usage statistics.
D. Query execution plans.
Answer: C
Explanation: Many AI APIs return token usage information, which is useful for monitoring API consumption and estimating costs.
Question 6
What does a finish reason of stop typically indicate?
A. The request exceeded the maximum token limit.
B. The response was blocked by a content filter.
C. The model completed the response normally.
D. Authentication failed.
Answer: C
Explanation: A finish reason of stop indicates that the model reached a natural completion point without interruption.
Question 7
A developer receives multiple candidate responses from an AI service.
Which SQL feature is best suited for processing all returned responses?
A. JSON_VALUE
B. OPENJSON
C. GROUP BY
D. FOR JSON AUTO
Answer: B
Explanation: OPENJSON can iterate through arrays, making it ideal for processing multiple response choices.
Question 8
Which practice best improves the reliability of applications consuming AI responses?
A. Assume every response follows the same JSON schema.
B. Execute AI-generated SQL statements without review.
C. Validate the response structure and handle errors gracefully.
D. Ignore API error messages.
Answer: C
Explanation: Validating responses and implementing robust error handling help applications remain reliable even when API responses change or errors occur.
Question 9
Why should developers avoid storing unnecessary metadata from AI responses?
A. Metadata prevents JSON parsing.
B. It can increase storage requirements without providing business value.
C. Metadata invalidates embeddings.
D. Metadata reduces retrieval accuracy.
Answer: B
Explanation: Storing only the required information minimizes storage costs and simplifies downstream processing.
Question 10
A SQL application receives the following JSON:
{
"choices":[
{
"message":{
"content":"The shipment will arrive tomorrow."
}
}
]
}
Which value should typically be presented to the end user?
A. The complete JSON document.
B. The choices array.
C. The generated text contained in message.content.
D. The API response identifier.
Answer: C
Explanation: The value stored in message.content contains the natural-language response generated by the language model and is typically the information displayed to users.
Welcome to the AB-730: AI Business Professional Exam Prep Hub!
Welcome to the one-stop hub with information for preparing for the AB-730: AI Business Professional certification exam. The content for this exam helps you to demonstrate that you “have experience using generative AI–powered productivity tools, including Microsoft 365 Copilot, Researcher, and Analyst. You take advantage of AI to improve daily work, drive business outcomes, and make informed decisions in business contexts—without building AI apps or writing code”. And also, that you “have a basic understanding of Microsoft 365 and should be comfortable navigating core apps, such as Outlook, Word, Microsoft Teams, PowerPoint, and Excel. You should also be familiar with common business processes, including drafting emails, creating presentations, generating images, and managing documents.”. Upon successful completion of the exam, you earn the Microsoft Certified: AI Business Professional certification.
This hub provides information directly here (topic-by-topic as outlined in the official study guide), links to a number of external resources, tips for preparing for the exam, practice tests, and section questions to help you prepare. Bookmark this page and use it as a guide to ensure that you are fully covering all relevant topics for the AB-730 exam and making use of as many of the resources available as possible.
Audience profile (from Microsoft’s site)
As a candidate for this Microsoft Certification, you should have experience using generative AI–powered productivity tools, including Microsoft 365 Copilot, Researcher, and Analyst. You take advantage of AI to improve daily work, drive business outcomes, and make informed decisions in business contexts—without building AI apps or writing code.
You should have a basic understanding of Microsoft 365 and should be comfortable navigating core apps, such as Outlook, Word, Microsoft Teams, PowerPoint, and Excel. You should also be familiar with common business processes, including drafting emails, creating presentations, generating images, and managing documents.
This post is a part of the AB-730: AI Business Professional Exam Prep Hub. This topic falls under these sections: Draft and analyze business content by using AI (25–30%) --> Draft business documents and communications --> Generate a management summary based on a document
Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 2 practice tests with 60 questions each available from the hub's main page below the exam topics section.
Introduction
One of the most practical uses of Microsoft 365 Copilot is generating management summaries from existing documents. Executives and managers often do not have time to read lengthy reports, technical documents, meeting notes, or project updates in their entirety. Microsoft 365 Copilot helps by extracting key information and presenting it in a concise, business-focused format.
For the AB-730: AI Business Professional exam, you should understand how Copilot can create management summaries, why they are useful, and why human review remains important.
What Is a Management Summary?
A management summary (sometimes called an executive summary) is a brief overview of a larger document that highlights:
Key findings
Important decisions
Major risks
Business impacts
Recommendations
Action items
The purpose is to provide decision-makers with essential information without requiring them to read the complete source document.
How Copilot Generates a Management Summary
Microsoft 365 Copilot can analyze an existing document and identify the most important information.
Typical workflow:
Step 1: Open the Source Document
Examples include:
Project reports
Sales analyses
Meeting notes
Research documents
Financial summaries
Status reports
Step 2: Prompt Copilot
Examples:
Create a management summary of this document.
Summarize this report for executives.
Highlight the key findings and recommended actions.
Step 3: Copilot Analyzes the Content
Copilot identifies:
Major themes
Significant data points
Conclusions
Risks and opportunities
Step 4: Generate the Summary
The resulting document may contain:
Overview sections
Bullet points
Recommendations
Action items
Key metrics
Why Management Summaries Are Valuable
Save Time
Leaders can quickly understand important information.
Improve Decision-Making
Critical insights are easier to identify.
Simplify Complex Documents
Long technical reports become easier for non-technical audiences to understand.
Increase Productivity
Teams spend less time manually creating summaries.
Improve Communication
Executives receive information in a concise, standardized format.
Common Business Scenarios
Project Status Reports
Source:
Detailed project documentation
Output:
One-page leadership summary
Sales Reports
Source:
Quarterly sales analysis
Output:
Revenue trends and recommendations
Meeting Notes
Source:
Teams meeting transcripts
Output:
Decisions and action items
Research Documents
Source:
Market studies
Output:
Strategic recommendations
Risk Assessments
Source:
Compliance reports
Output:
Identified risks and mitigation plans
Example Prompts
Basic Summary
Create a management summary of this report.
Executive Audience
Summarize this document for senior leadership.
Focus on Actions
Highlight key findings and recommended next steps.
Focus on Risks
Identify risks and business impacts discussed in this document.
Concise Output
Create a one-page executive summary with bullet points.
Characteristics of a Good Management Summary
Effective summaries are:
Concise
Only the most important information is included.
Relevant
Information is tailored to management needs.
Action-Oriented
Recommendations and next steps are clearly identified.
Easy to Read
Complex details are simplified.
Business-Focused
Attention is placed on outcomes and impacts.
Example Transformation
Original Document
A 40-page technical migration report containing:
Architecture details
Performance metrics
Testing results
Risks
Costs
Management Summary
One page containing:
Overall project status
Key findings
Estimated costs
Major risks
Recommended actions
This allows executives to understand the situation quickly.
Refining the Summary
Users can improve results with follow-up prompts:
“Make the summary shorter.”
“Use bullet points.”
“Rewrite for executives.”
“Add recommendations.”
“Focus on risks and costs.”
“Use a formal tone.”
Iterative prompting often produces better results.
Human Review Remains Important
Although Copilot saves time, users should verify:
Accuracy
Ensure important facts are correct.
Completeness
Confirm critical information was not omitted.
Audience Appropriateness
Make sure the summary matches leadership expectations.
Tone
Ensure the language is professional.
Business Context
Validate that recommendations make sense.
Copilot assists with summarization, but humans remain responsible for final decisions.
Security and Permissions
Microsoft 365 Copilot:
Respects Microsoft 365 permissions.
Uses only information users can already access.
Does not bypass security settings.
Follows existing organizational data protections.
Best Practices
Specify the Audience
Examples:
Executives
Managers
Project sponsors
Define Desired Length
Examples:
One page
Five bullet points
Brief overview
Request Specific Focus Areas
Examples:
Risks
Costs
Recommendations
Action items
Review the Output
Always validate the final summary.
Use Iterative Prompts
Continue refining until the summary meets business needs.
Exam Tips
For the AB-730 exam, remember:
Copilot can create management summaries from existing documents.
Summaries help leaders quickly understand important information.
Prompts can specify audience, tone, and focus areas.
Follow-up prompts improve output quality.
Human review remains necessary.
Copilot respects existing Microsoft 365 permissions.
Management summaries emphasize business value rather than technical detail.
Practice Exam Questions
Question 1
What is the primary purpose of a management summary?
A. To provide a concise overview of important information for decision-makers. B. To replace the original document permanently. C. To eliminate the need for leadership review. D. To provide all technical details in full.
Correct Answer: A
Explanation: Management summaries help leaders quickly understand key information without reading lengthy documents.
Question 2
Which type of source document could Copilot summarize?
A. Only Word documents. B. Only meeting transcripts. C. Various business documents such as reports, notes, and analyses. D. Only PowerPoint presentations.
Correct Answer: C
Explanation: Copilot can summarize many kinds of business content.
Question 3
Why are management summaries useful?
A. They help executives save time. B. They automatically guarantee perfect decisions. C. They replace managers. D. They prevent future edits.
Correct Answer: A
Explanation: Summaries provide quick access to important information.
Question 4
Which prompt is most specific?
A. “Do something with this report.” B. “Summarize.” C. “Create a one-page executive summary focusing on risks and recommendations.” D. “Write words.”
Correct Answer: C
Explanation: Detailed prompts usually produce better results.
Question 5
Which information is commonly included in a management summary?
A. Key findings and recommendations. B. Entire source documents word for word. C. Hidden security settings. D. File metadata only.
Correct Answer: A
Explanation: Summaries focus on important business information.
Question 6
After Copilot generates a management summary, users should:
A. Share it immediately without reading it. B. Delete the original report. C. Review accuracy and completeness. D. Assume every recommendation is correct.
Correct Answer: C
Explanation: Human review remains essential.
Question 7
Which audience typically benefits most from management summaries?
A. Senior leadership and managers. B. Network printers. C. Hardware manufacturers. D. Database engines.
Correct Answer: A
Explanation: Executives often need concise information rather than full reports.
Question 8
What can follow-up prompts help accomplish?
A. Prevent editing. B. Improve and refine the summary. C. Remove security permissions. D. Disable Copilot.
Correct Answer: B
Explanation: Iterative prompting allows users to tailor results.
Question 9
How does Microsoft 365 Copilot handle security when summarizing documents?
A. It ignores permissions. B. It grants access to restricted files. C. It follows existing Microsoft 365 access controls. D. It automatically shares files with everyone.