Author: thedatacommunity

Extract language model responses (DP-800 Exam Prep)

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:

RequestIDUserQuestionAIResponseDateGenerated

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 ReasonDescription
stopNormal completion
lengthMaximum token limit reached
content_filterResponse 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.

Real-World Example

A customer asks:

“Summarize this support ticket.”

The application:

  1. Retrieves ticket information from SQL.
  2. Sends it to a language model.
  3. Receives:
{
"choices":[
{
"message":{
"content":"The customer reports intermittent login failures caused by expired authentication tokens."
}
}
]
}

The application extracts:

SELECT JSON_VALUE(@Response,
'$.choices[0].message.content');

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.


Go to the DP-800 Exam Prep Hub main page

DP-800 Practice Exam #1 (30 questions)

This post/practice exam is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.


Question 1 (Single Answer)

You are designing a database for an online retail application. The Orders table will contain millions of records, and queries will frequently retrieve orders for a single customer ordered by purchase date.

Which index design provides the BEST performance?

A. Create a clustered index on OrderDate

B. Create a clustered index on OrderID and a nonclustered index on CustomerID

C. Create a clustered index on CustomerID, OrderDate

D. Create a nonclustered columnstore index on all columns

Answer: C

Explanation

Since most queries filter by CustomerID and sort by OrderDate, a clustered index on (CustomerID, OrderDate) physically organizes the data in the same order as the most common access pattern, minimizing page reads and sorting.

  • A does not optimize customer lookups.
  • B optimizes customer filtering but still requires additional sorting.
  • D is designed primarily for analytical workloads rather than OLTP.

Question 2 (Choose TWO)

Your organization wants to improve the security of an Azure SQL Database.

Which TWO features help protect sensitive information?

A. Dynamic Data Masking

B. SQL Server Agent

C. Row-Level Security

D. Query Store

E. Automatic Tuning

Choose TWO answers.

Answers:

✅ A

✅ C

Explanation

Dynamic Data Masking hides sensitive values from unauthorized users.

Row-Level Security restricts which rows users can access.

SQL Server Agent, Query Store, and Automatic Tuning are not security features.


Question 3 (Scenario)

A company is building a Retrieval-Augmented Generation (RAG) solution.

Customer manuals have already been converted into embeddings and stored in a vector index.

A user asks:

“How do I replace the printer toner?”

What should happen NEXT?

A. Generate new embeddings for every document.

B. Perform a vector similarity search using the user’s question embedding.

C. Retrain the language model.

D. Build a clustered index.

Answer: B

Explanation

After embeddings already exist, the user question is embedded and compared against the vector index to retrieve the most relevant documents before prompting the language model.


Question 4 (Fill in the Blank)

Complete the following statement.

The SQL clause most commonly used to convert relational query results into JSON documents is:


A. FOR XML

B. OPENJSON

C. JSON_VALUE

D. FOR JSON

Answer: D

Explanation

FOR JSON converts relational data into JSON.

  • FOR JSON AUTO automatically generates JSON.
  • FOR JSON PATH allows customized JSON structures.

Question 5 (Choose THREE)

A database developer wants to create high-quality prompts for a language model.

Which THREE practices are recommended?

A. Include only relevant retrieved context.

B. Include every available document.

C. Clearly specify the model’s task.

D. Remove duplicate retrieved information.

E. Leave instructions ambiguous.

Choose THREE answers.

Answers

✅ A

✅ C

✅ D

Explanation

Effective prompts:

  • include only relevant context,
  • provide clear instructions,
  • remove duplicate or unnecessary information.

Large, irrelevant prompts increase costs and often reduce answer quality.


Question 6 (Match the Answers)

Match each SQL JSON function with its purpose.

FunctionPurpose
1. JSON_VALUEA. Returns a JSON object or array
2. JSON_QUERYB. Converts JSON into relational rows
3. OPENJSONC. Returns a scalar value

Answer

FunctionCorrect Match
JSON_VALUEC
JSON_QUERYA
OPENJSONB

Explanation

  • JSON_VALUE returns a scalar value.
  • JSON_QUERY returns objects or arrays.
  • OPENJSON converts JSON into tabular data.

Question 7 (Single Answer)

Which similarity metric is generally recommended when comparing normalized embedding vectors?

A. Manhattan Distance

B. Euclidean Distance

C. Hamming Distance

D. Cosine Similarity

Answer: D

Explanation

Cosine similarity measures the angle between vectors and is the most commonly used similarity metric for normalized embeddings because it focuses on semantic direction rather than vector magnitude.


Question 8 (Scenario)

Your company stores customer support articles inside Azure SQL Database.

The support team wants an AI assistant that always answers questions using the latest documentation stored in the database.

Which solution should you recommend?

A. Fine-tune the language model every night.

B. Use Retrieval-Augmented Generation (RAG).

C. Train a custom transformer model.

D. Store every support article inside the prompt.

Answer: B

Explanation

RAG retrieves current documentation at query time, ensuring responses reflect the latest information without retraining the language model.


Question 9 (Ordering)

A developer is building a SQL-based RAG application using sp_invoke_external_rest_endpoint.

Arrange the following steps in the correct order.

  1. Retrieve relevant documents.
  2. Call the language model.
  3. Generate embeddings for the user question.
  4. Construct the prompt.

Correct Order

3 → 1 → 4 → 2

Explanation

The workflow is:

  1. Generate an embedding for the user’s question.
  2. Retrieve similar documents.
  3. Build the prompt using the retrieved context.
  4. Send the prompt to the language model.

Question 10 (Scenario-Based)

A company has implemented hybrid search that combines keyword search and vector search.

The search results are merged using Reciprocal Rank Fusion (RRF).

What is the primary purpose of RRF?

A. Generate embeddings.

B. Merge and re-rank results from multiple retrieval methods.

C. Compress vector indexes.

D. Convert SQL data into JSON.

Answer: B

Explanation

Reciprocal Rank Fusion (RRF) combines ranked result lists from different retrieval methods (such as keyword search and vector search) into a single ranking. This often improves search quality by leveraging the strengths of each retrieval technique.


Question 11 (Single Answer)

Your company maintains several stored procedures that perform complex business logic. The procedures are executed thousands of times each hour, but the execution plans frequently become inefficient because parameter values vary significantly.

Which feature should you implement to reduce parameter sensitivity issues?

A. Enable Query Store

B. Use Parameter Sensitive Plan (PSP) optimization

C. Create a clustered columnstore index

D. Enable Dynamic Data Masking

Answer: B

Explanation

Parameter Sensitive Plan (PSP) optimization allows SQL Server to maintain multiple execution plans for different parameter value ranges, improving performance when parameter distributions vary significantly.

  • Query Store helps monitor plans but does not solve parameter sensitivity by itself.
  • Columnstore indexes target analytical workloads.
  • Dynamic Data Masking is unrelated to performance.

Question 12 (Choose TWO)

You are developing a SQL application that calls an Azure AI model by using sp_invoke_external_rest_endpoint.

Which two components are typically required in the REST request?

A. HTTP headers

B. JSON payload

C. XML schema

D. SQL CLR assembly

E. SQL Agent Job

Choose TWO answers.

Answers

A

B

Explanation

REST requests to AI services generally require:

  • HTTP headers (authentication, content type)
  • A JSON request body containing the prompt and parameters

The remaining options are unrelated.


Question 13 (Scenario)

A financial institution is implementing Row-Level Security (RLS).

Managers should see records only for employees in their own department.

Which component enforces this behavior?

A. Dynamic Data Masking

B. Security policy using a predicate function

C. Transparent Data Encryption

D. Query Store

Answer: B

Explanation

Row-Level Security uses an inline table-valued predicate function combined with a security policy to filter rows automatically based on the executing user’s context.


Question 14 (Match the Answers)

Match each SQL object with its primary purpose.

SQL ObjectPurpose
1. ViewA. Stores executable business logic
2. Stored ProcedureB. Represents a virtual table
3. TriggerC. Executes automatically after data modifications

Answer

SQL ObjectCorrect Match
ViewB
Stored ProcedureA
TriggerC

Explanation

  • Views provide virtual tables.
  • Stored procedures encapsulate reusable logic.
  • Triggers automatically execute when INSERT, UPDATE, or DELETE events occur.

Question 15 (Single Answer)

A developer needs to generate embeddings for thousands of product descriptions before building a vector index.

What should happen first?

A. Create the vector index.

B. Build the hybrid search pipeline.

C. Generate embeddings for each document.

D. Call the language model.

Answer: C

Explanation

Embeddings must exist before a vector index can be populated. The typical workflow is:

  1. Generate embeddings.
  2. Store vectors.
  3. Create/populate the vector index.
  4. Perform similarity search.

Question 16 (Choose THREE)

Which three practices improve database security?

A. Enable Transparent Data Encryption (TDE)

B. Implement least-privilege permissions

C. Disable authentication logging

D. Apply Dynamic Data Masking where appropriate

E. Grant db_owner to all developers

Choose THREE answers.

Answers

A

B

D

Explanation

These practices strengthen database security by protecting data at rest, limiting user permissions, and masking sensitive information.

Granting excessive permissions and disabling auditing reduce security.


Question 17 (Scenario)

Your organization uses Azure SQL Database.

Developers frequently overwrite one another’s schema changes during deployment.

Management wants schema changes tracked, versioned, reviewed, and automatically deployed.

Which technology best satisfies these requirements?

A. Query Store

B. SQL Database Projects with Git and CI/CD

C. SQL Profiler

D. SQL Server Agent

Answer: B

Explanation

SQL Database Projects integrate with source control systems and CI/CD pipelines, enabling controlled schema versioning, peer review, automated validation, and repeatable deployments.


Question 18 (Fill in the Blank)

Complete the statement.

The SQL function most commonly used to retrieve a single scalar value from a JSON document is:


A. OPENJSON

B. JSON_QUERY

C. JSON_VALUE

D. FOR JSON PATH

Answer: C

Explanation

JSON_VALUE extracts individual scalar values such as strings, numbers, or Boolean values from JSON documents.


Question 19 (Scenario-Based)

A retail company has implemented hybrid search using both keyword search and vector search.

Testing shows that keyword search finds exact product numbers, while vector search finds semantically similar products.

Management wants both result sets combined into one ranked list.

Which technique should be used?

A. Euclidean Distance

B. Principal Component Analysis

C. Reciprocal Rank Fusion (RRF)

D. K-Means Clustering

Answer: C

Explanation

Reciprocal Rank Fusion combines ranked results from multiple retrieval methods, producing a single ranking that benefits from both lexical and semantic matching.


Question 20 (Multi-Answer)

A SQL developer is preparing structured customer information before sending it to a language model.

Which three practices are recommended?

A. Remove sensitive information that is not required.

B. Convert relational results into JSON.

C. Include every available database column.

D. Send only the fields needed for the prompt.

E. Ignore row-level security because the AI model is trusted.

Choose THREE answers.

Answers

A

B

D

Explanation

Preparing structured data for AI involves:

  • Removing unnecessary or sensitive information.
  • Converting relational data to JSON.
  • Sending only relevant fields to minimize token usage and improve performance.

Including all columns wastes tokens and may expose confidential information. Existing security controls should remain in effect.


Question 21 (Scenario-Based)

A company is building a customer support chatbot using Retrieval-Augmented Generation (RAG). Product manuals are updated daily, and management wants the chatbot to use the newest documentation immediately without retraining the language model.

Which architecture best satisfies this requirement?

A. Fine-tune the language model every evening.

B. Store all manuals directly in the prompt.

C. Use a vector index to retrieve relevant documents during each user query.

D. Convert all manuals into stored procedures.

Answer: C

Explanation

RAG retrieves the most relevant documents at query time using a vector search, allowing the chatbot to use newly added documentation without retraining the model.

  • Fine-tuning is expensive and unnecessary for frequently changing data.
  • Including all manuals in every prompt exceeds token limits.
  • Stored procedures cannot replace document retrieval.

Question 22 (Choose TWO)

Which TWO characteristics are true of embedding vectors?

A. Similar meanings produce vectors that are close together.

B. Embeddings store the original document text.

C. Embeddings represent semantic meaning numerically.

D. Embeddings require clustered indexes.

E. Embeddings replace relational databases.

Choose TWO answers.

Answers

A

C

Explanation

Embeddings are numerical representations of semantic meaning. Similar concepts generate vectors that are close together within vector space.


Question 23 (Single Answer)

A developer wants to improve the performance of a vector similarity search.

Which action provides the greatest benefit?

A. Increase the SQL transaction log size.

B. Create an appropriate vector index.

C. Enable Dynamic Data Masking.

D. Compress the database backup.

Answer: B

Explanation

Vector indexes dramatically improve similarity search performance by reducing the number of vectors that must be examined during nearest-neighbor searches.


Question 24 (Scenario-Based)

A SQL application calls an Azure AI model by using sp_invoke_external_rest_endpoint.

The returned JSON contains the following:

{
"choices": [
{
"message": {
"content": "Always validate user input."
}
}
]
}

Which SQL function should be used to extract only the generated response?

A. OPENJSON

B. JSON_QUERY

C. FOR JSON PATH

D. JSON_VALUE

Answer: D

Explanation

JSON_VALUE() extracts a single scalar value, making it ideal for retrieving choices[0].message.content.


Question 25 (Ordering)

Arrange the following steps for implementing vector search.

  1. Generate embeddings.
  2. Store embeddings in the database.
  3. Create the vector index.
  4. Execute similarity searches.

Correct Order

1 → 2 → 3 → 4

Explanation

Embeddings must first be generated and stored before the vector index can be created and used for similarity searches.


Question 26 (Match the Answers)

Match each AI concept with its description.

ConceptDescription
1. EmbeddingA. Combines keyword and vector search rankings
2. Hybrid SearchB. Numerical representation of semantic meaning
3. Reciprocal Rank FusionC. Executes keyword and vector searches together

Answer

ConceptCorrect Match
EmbeddingB
Hybrid SearchC
Reciprocal Rank FusionA

Explanation

  • Embeddings convert data into semantic vectors.
  • Hybrid search combines lexical and semantic retrieval.
  • RRF merges multiple ranked result lists into a single ranking.

Question 27 (Choose THREE)

Which THREE practices improve prompt quality for Retrieval-Augmented Generation?

A. Include only relevant retrieved documents.

B. Clearly describe the task.

C. Add duplicate context whenever possible.

D. Specify the desired output format.

E. Include unrelated reference material.

Choose THREE answers.

Answers

A

B

D

Explanation

Good prompts:

  • include only relevant context,
  • clearly define the task,
  • specify the expected response format.

Duplicate or unrelated information wastes tokens and may reduce answer quality.


Question 28 (Scenario-Based)

A company stores HR information in Azure SQL Database.

Only Human Resources employees should view employee salaries, even when an AI application queries the database.

Which solution provides the BEST protection?

A. Transparent Data Encryption

B. Row-Level Security

C. Automatic Indexing

D. Query Store

Answer: B

Explanation

Row-Level Security ensures only authorized users can access rows containing sensitive salary information, regardless of whether the data is accessed directly or through an AI-enabled application.


Question 29 (Single Answer)

A developer needs to reduce API costs when sending requests to a language model.

Which action is MOST effective?

A. Increase the embedding dimensions.

B. Send every available database column.

C. Include only relevant context in the prompt.

D. Increase the maximum response tokens.

Answer: C

Explanation

Reducing unnecessary prompt content decreases token usage, lowers costs, improves latency, and often improves answer quality.


Question 30 (Comprehensive Scenario)

A software company is developing an AI-powered knowledge assistant using Azure SQL Database.

The application requirements are:

  • Store technical documents.
  • Support semantic search.
  • Combine keyword and vector search.
  • Retrieve the best documents.
  • Send the retrieved context to a language model.
  • Display AI-generated answers.
  • Use current documentation without retraining.

Which architecture BEST satisfies these requirements?

A. Fine-tune the language model after every documentation update.

B. Store every document inside a single SQL stored procedure.

C. Export all documents into CSV files before every query.

D. Implement a Retrieval-Augmented Generation (RAG) solution using embeddings, vector search, hybrid search, and prompt construction.

Answer: D

Explanation

A RAG architecture provides exactly the required functionality:

  • Documents remain in the database.
  • Embeddings enable semantic retrieval.
  • Hybrid search combines keyword and vector search.
  • Retrieved documents become prompt context.
  • The language model generates grounded responses.
  • Documentation updates are immediately available without retraining.

Go to the DP-800 Exam Prep Hub main page

DP-800 Practice Exam #2 (30 questions)

This post/practice exam is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.


Question 1 (Scenario-Based)

A software company is designing a SQL Server database for an online reservation system. Each reservation has a unique ReservationID that is never updated. Most transactions retrieve reservations by ReservationID.

Which indexing strategy should you recommend?

A. Create a clustered index on ReservationID.

B. Create a nonclustered index on every column.

C. Create a clustered columnstore index.

D. Do not create indexes until performance problems occur.

Answer: A

Explanation

A clustered index on a stable, unique key such as ReservationID is ideal for OLTP workloads because it provides efficient point lookups and organizes the table by the primary access path.

  • Nonclustered indexes on every column increase maintenance overhead.
  • Clustered columnstore indexes are intended for analytics.
  • Waiting to create indexes is not a best practice for well-understood workloads.

Question 2 (Choose TWO)

A development team wants to improve database deployment quality using SQL Database Projects.

Which TWO benefits does this approach provide?

A. Source control integration

B. Automatic vector embedding generation

C. Schema validation before deployment

D. Automatic Row-Level Security configuration

E. Automatic model fine-tuning

Choose TWO answers.

Answers

A

C

Explanation

SQL Database Projects support:

  • Version control integration (Git, Azure DevOps, GitHub)
  • Build-time validation of schema changes
  • Automated CI/CD deployment

They do not automatically configure security policies or AI models.


Question 3 (Single Answer)

A database contains personally identifiable information (PII). Customer service representatives should see only partially masked Social Security numbers, while administrators should see the complete values.

Which feature should you implement?

A. Transparent Data Encryption

B. Row-Level Security

C. Dynamic Data Masking

D. Always Encrypted

Answer: C

Explanation

Dynamic Data Masking hides portions of sensitive data for non-privileged users while allowing authorized users to view the original values.

  • TDE protects data at rest.
  • RLS filters rows.
  • Always Encrypted protects data from the database engine itself and is a stronger encryption solution, but it does not provide role-based masking behavior.

Question 4 (Fill in the Blank)

Complete the statement.

The SQL function used to convert JSON arrays into relational rows is:

A. JSON_VALUE

B. JSON_QUERY

C. OPENJSON

D. FOR JSON AUTO

Answer: C

Explanation

OPENJSON parses JSON objects and arrays into relational rows and columns that can be queried using T-SQL.


Question 5 (Scenario-Based)

Your organization has implemented Retrieval-Augmented Generation (RAG).

Users report that the chatbot often provides outdated information, even though newer documentation has already been uploaded.

Which action is MOST likely to resolve the issue?

A. Increase the model temperature.

B. Regenerate embeddings for the newly added documents and update the vector index.

C. Enable Query Store.

D. Increase MAXDOP.

Answer: B

Explanation

New documents must be embedded and indexed before they can be retrieved through vector search. Without updated embeddings, the retrieval process cannot find the new content.


Question 6 (Match the Answers)

Match each database security feature with its primary purpose.

FeaturePurpose
1. Transparent Data EncryptionA. Restricts visible rows
2. Row-Level SecurityB. Encrypts database files at rest
3. Dynamic Data MaskingC. Masks sensitive column values

Answer

FeatureCorrect Match
Transparent Data EncryptionB
Row-Level SecurityA
Dynamic Data MaskingC

Explanation

  • TDE encrypts the database on disk.
  • RLS filters rows returned to users.
  • DDM masks column values for unauthorized users.

Question 7 (Choose THREE)

Which THREE factors improve the quality of vector search results?

A. Generate high-quality embeddings using an appropriate embedding model.

B. Chunk large documents into meaningful sections.

C. Store embeddings as VARCHAR values.

D. Use an appropriate vector similarity metric.

E. Disable vector indexing.

Choose THREE answers.

Answers

A

B

D

Explanation

Effective vector search depends on:

  • High-quality embeddings
  • Appropriate document chunking
  • Correct similarity metrics (such as cosine similarity)

Storing embeddings as text or disabling indexes reduces performance and effectiveness.


Question 8 (Scenario-Based)

A SQL application sends prompts to an Azure AI model using sp_invoke_external_rest_endpoint.

The application receives HTTP status code 429.

What does this status code indicate?

A. Authentication failed.

B. The request contains malformed JSON.

C. The service is rate limiting requests.

D. The model generated an invalid response.

Answer: C

Explanation

HTTP 429 means Too Many Requests. The application should implement retry logic with exponential backoff to handle temporary throttling.


Question 9 (Ordering)

Arrange the following CI/CD workflow in the correct order.

  1. Commit schema changes.
  2. Validate the SQL Database Project.
  3. Deploy to the production environment.
  4. Build the deployment artifact.

Correct Order

1 → 2 → 4 → 3

Explanation

The typical workflow is:

  1. Commit changes to source control.
  2. Validate the project during the build.
  3. Generate the deployment artifact (such as a DACPAC).
  4. Deploy to production through the release pipeline.

Question 10 (Comprehensive Scenario)

A company is building an AI-powered search application.

Requirements:

  • Support traditional keyword searches.
  • Support semantic similarity searches.
  • Combine both result sets into one ranked list.
  • Improve relevance without retraining the language model.

Which solution best satisfies these requirements?

A. Increase the embedding dimensions.

B. Implement hybrid search with Reciprocal Rank Fusion (RRF).

C. Fine-tune the language model every week.

D. Replace vector search with LIKE queries.

Answer: B

Explanation

Hybrid search combines keyword and vector search results. Reciprocal Rank Fusion (RRF) merges and reranks the results, improving retrieval quality by leveraging both lexical and semantic matching.


Question 11 (Scenario-Based)

A database developer creates the following query:

SELECT *
FROM Sales
WHERE CustomerID = 1050;

The query runs frequently against a table containing 500 million rows.

The query execution plan shows that SQL Server performs a table scan.

What should you do to improve performance?

A. Create a nonclustered index on CustomerID.

B. Enable Transparent Data Encryption.

C. Increase the database compatibility level.

D. Convert the table to JSON format.

Answer: A

Explanation

A nonclustered index on CustomerID allows SQL Server to quickly locate matching rows instead of scanning the entire table.

  • TDE does not improve query performance.
  • Compatibility changes may enable features but do not directly solve this issue.
  • JSON conversion would negatively impact relational query performance.

Question 12 (Choose TWO)

A developer is creating a stored procedure that will be called by an application.

Which TWO practices improve the security and reliability of the stored procedure?

A. Use parameterized inputs.

B. Grant users direct access to all underlying tables.

C. Validate input parameters.

D. Construct SQL statements using string concatenation.

E. Disable error handling.

Choose TWO answers.

Answers

A

C

Explanation

Parameterized inputs reduce SQL injection risk, while input validation ensures the procedure receives expected values.

Avoid:

  • Direct table access when unnecessary.
  • Dynamic SQL built through string concatenation.
  • Removing error handling.

Question 13 (Single Answer)

A company wants to track query performance regressions after deploying database changes.

Which SQL feature should be used?

A. Query Store

B. Dynamic Data Masking

C. Database Mail

D. Change Tracking

Answer: A

Explanation

Query Store captures query execution information, including:

  • Query text
  • Execution plans
  • Runtime statistics
  • Historical performance

This allows administrators to identify regressions after deployments.


Question 14 (Scenario-Based)

A company stores product descriptions in Azure SQL Database.

They want customers to search for:

“comfortable shoes for hiking”

and retrieve products described as:

“lightweight trail footwear designed for long walks.”

A traditional keyword search does not return the correct results.

What should you implement?

A. Foreign key constraints

B. Vector embeddings and similarity search

C. Additional clustered indexes

D. Data compression

Answer: B

Explanation

Keyword search depends on exact terms. Vector search uses embeddings to understand semantic similarity, allowing conceptually related results to be returned.


Question 15 (Fill in the Blank)

Complete the statement.

The process of converting text, images, or other data into numerical representations that capture semantic meaning is called:


A. Tokenization

B. Index fragmentation

C. Embedding

D. Encryption

Answer: C

Explanation

An embedding converts information into a numerical vector representation that can be compared mathematically for similarity.


Question 16 (Match the Answers)

Match each SQL performance feature with its purpose.

FeaturePurpose
1. Query StoreA. Automatically adjusts database performance settings
2. Automatic TuningB. Stores historical query performance information
3. Columnstore IndexC. Optimizes analytical queries over large datasets

Answer

FeatureCorrect Match
Query StoreB
Automatic TuningA
Columnstore IndexC

Explanation

  • Query Store tracks query history.
  • Automatic Tuning can recommend or apply performance improvements.
  • Columnstore indexes accelerate analytical workloads.

Question 17 (Choose THREE)

You are implementing a Retrieval-Augmented Generation solution.

Which THREE components are required?

A. A data source containing grounding information

B. An embedding model

C. A retrieval mechanism

D. A clustered index on every table

E. A database trigger for every document

Choose THREE answers.

Answers

A

B

C

Explanation

A RAG system requires:

  1. Source information.
  2. Embeddings to represent semantic meaning.
  3. Retrieval to find relevant context.

Clustered indexes and triggers are not required components of RAG.


Question 18 (Scenario-Based)

A developer sends database information to a language model.

The prompt contains:

  • Customer name
  • Customer address
  • Internal account identifier
  • Product question

The model only needs the product question and relevant product information.

What should the developer do?

A. Include all data because larger prompts improve accuracy.

B. Remove unnecessary customer information before creating the prompt.

C. Disable database security features.

D. Increase the model temperature.

Answer: B

Explanation

Only relevant information should be sent to the language model.

Benefits include:

  • Reduced token usage
  • Lower cost
  • Better privacy
  • Improved response quality

Question 19 (Single Answer)

A developer needs to retrieve an entire JSON object from an AI model response.

Which SQL function should be used?

A. JSON_VALUE

B. JSON_QUERY

C. LEN

D. STRING_AGG

Answer: B

Explanation

JSON_QUERY returns JSON objects or arrays.

Example:

SELECT JSON_QUERY(@response, '$.choices');

JSON_VALUE is used only for scalar values.


Question 20 (Comprehensive Scenario)

A company is deploying a SQL Database Project through Azure DevOps.

The deployment process must:

  • Validate schema changes
  • Prevent unauthorized database modifications
  • Automatically deploy approved changes

Which approach should be implemented?

A. Allow developers to manually modify production databases.

B. Use source control, build validation, and automated deployment pipelines.

C. Store database scripts on local developer machines.

D. Disable all database permissions during deployment.

Answer: B

Explanation

A proper CI/CD workflow includes:

  • Source control management
  • Automated builds
  • Validation
  • Deployment approvals
  • Automated release pipelines

This improves consistency, security, and reliability.


Question 21 (Scenario-Based)

A company has implemented a vector search solution in Azure SQL Database.

Users report that searches sometimes return documents that contain similar words but do not answer the actual question.

The development team wants results that consider both exact keyword matches and semantic similarity.

What should the team implement?

A. Increase the number of database indexes.

B. Hybrid search combining keyword and vector search.

C. Replace embeddings with relational columns.

D. Increase SQL Server memory allocation.

Answer: B

Explanation

Hybrid search combines:

  • Traditional lexical search (keyword matching)
  • Vector search (semantic similarity)

This improves retrieval quality because each method addresses different search scenarios.


Question 22 (Choose TWO)

A developer is evaluating vector search performance.

Which TWO factors should be considered when selecting a similarity metric?

A. The type of embedding model being used.

B. The database recovery model.

C. Whether vectors are normalized.

D. The number of database users.

E. The table’s foreign keys.

Choose TWO answers.

Answers

A

C

Explanation

Similarity metrics should align with:

  • The characteristics of the embedding model.
  • Whether vectors are normalized.

Common metrics include:

  • Cosine similarity
  • Euclidean distance
  • Dot product

Database recovery models and relational constraints do not affect vector similarity calculations.


Question 23 (Single Answer)

A developer wants to combine rankings from a vector search query and a keyword search query.

Which algorithm should be used?

A. Reciprocal Rank Fusion (RRF)

B. K-means clustering

C. Gradient descent

D. Binary search

Answer: A

Explanation

Reciprocal Rank Fusion combines multiple ranked result lists into a single ranking.

It is commonly used in hybrid search solutions because it does not require the scores from different search systems to be directly comparable.


Question 24 (Scenario-Based)

A company uses an AI assistant to answer questions about internal policies.

The assistant sometimes generates responses that are not supported by company documentation.

Which RAG improvement should be implemented?

A. Remove document retrieval from the workflow.

B. Increase the model temperature.

C. Provide retrieved documents as grounding context in the prompt.

D. Train users to write longer questions.

Answer: C

Explanation

RAG reduces hallucinations by providing the language model with relevant retrieved information as context.

The prompt should include:

  • User question
  • Retrieved documents
  • Instructions to answer using provided information

Question 25 (Ordering)

Arrange the following steps for processing a user question in a RAG application.

  1. Send the augmented prompt to the language model.
  2. Generate an embedding for the user question.
  3. Retrieve similar documents.
  4. Combine the question and retrieved context.

Correct Order

2 → 3 → 4 → 1

Explanation

A RAG workflow follows these steps:

  1. Convert the question into an embedding.
  2. Search the vector index.
  3. Build the augmented prompt.
  4. Send it to the language model.

Question 26 (Match the Answers)

Match each technology with its purpose.

TechnologyPurpose
1. Vector IndexA. Generates natural language responses
2. Embedding ModelB. Enables efficient similarity searches
3. Language ModelC. Converts content into numerical vectors

Answer

TechnologyCorrect Match
Vector IndexB
Embedding ModelC
Language ModelA

Explanation

  • Vector indexes optimize searching through embeddings.
  • Embedding models convert data into numerical representations.
  • Language models generate responses.

Question 27 (Choose THREE)

A developer is implementing an enterprise AI assistant using SQL data.

Which THREE security practices should be followed?

A. Apply least-privilege permissions.

B. Remove unnecessary sensitive information from prompts.

C. Log prompts and responses securely.

D. Grant all AI services administrator permissions.

E. Disable auditing.

Choose THREE answers.

Answers

A

B

C

Explanation

Secure AI solutions should:

  • Follow least privilege.
  • Minimize sensitive data exposure.
  • Maintain secure logging and monitoring.

Granting excessive permissions and disabling auditing increase security risks.


Question 28 (Scenario-Based)

A developer receives this response from an AI service:

{
"choices": [
{
"message": {
"content": "The warranty expires after two years."
}
}
]
}

The developer needs to store only the generated answer in a SQL table.

Which query should be used?

A.

SELECT JSON_VALUE(@response,'$.choices');

B.

SELECT JSON_QUERY(@response,'$.choices[0]');

C.

SELECT JSON_VALUE(@response,'$.choices[0].message.content');

D.

SELECT OPENJSON(@response);

Answer: C

Explanation

JSON_VALUE extracts scalar values.

The generated answer is stored at:

$.choices[0].message.content

Question 29 (Single Answer)

A company notices that a SQL query became slower after a database deployment.

Which feature should administrators use to compare previous and current query performance?

A. Query Store

B. Data Masking

C. Database Mail

D. SQL Server Agent

Answer: A

Explanation

Query Store maintains historical information about:

  • Queries
  • Execution plans
  • Runtime statistics

It helps identify performance regressions after changes.


Question 30 (Comprehensive Scenario)

A company is creating an AI-powered document assistant.

Requirements:

  • Documents are stored in Azure SQL Database.
  • Users search using natural language.
  • Search must return relevant documents even when exact words differ.
  • Exact terms such as product IDs must still work.
  • Responses must be generated using retrieved information.
  • New documents should become available without model retraining.

Which architecture should be implemented?

A. Keyword search only with SQL LIKE queries.

B. Fine-tune the language model whenever documents change.

C. Implement RAG using embeddings, vector search, hybrid search, and prompt augmentation.

D. Store all documents directly in the language model.

Answer: C

Explanation

The correct architecture is a Retrieval-Augmented Generation solution:

  1. Generate embeddings for documents.
  2. Store embeddings in a vector-enabled database.
  3. Perform hybrid search:
    • Keyword search for exact matches.
    • Vector search for semantic similarity.
  4. Add retrieved context to the prompt.
  5. Generate a grounded response.

This allows new documents to become available without retraining the model.


Go to the DP-800 Exam Prep Hub main page

DP-800 Practice Exam #3 (30 questions)

This post/practice exam is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.


Question 1 (Scenario-Based)

A retail company is designing a SQL database for order processing.

Requirements:

  • Orders are frequently retrieved by OrderID.
  • New orders are inserted continuously.
  • The database supports thousands of transactions per minute.
  • Reports are generated against a separate analytical system.

Which indexing strategy should you recommend for the Orders table?

A. Use a clustered index on OrderID.

B. Use a clustered columnstore index.

C. Create nonclustered indexes on every column.

D. Store order data as JSON documents.

Answer: A

Explanation

An OLTP order-processing system benefits from a clustered index on the primary transaction key.

A clustered index:

  • Provides efficient lookups.
  • Supports frequent inserts and updates.
  • Organizes table storage.

Why the others are incorrect:

  • B: Clustered columnstore indexes are optimized for analytics, not high-volume OLTP.
  • C: Excessive indexes increase insert/update overhead.
  • D: JSON storage is not appropriate for a highly relational transaction workload.

Question 2 (Choose TWO)

A developer is creating a reusable database API layer using stored procedures.

Which TWO practices should be implemented?

A. Use input parameters instead of string concatenation.

B. Grant applications direct access to all tables.

C. Include error handling with TRY…CATCH.

D. Store passwords in stored procedure code.

E. Disable transaction handling.

Choose TWO answers.

Answers

A

C

Explanation

Stored procedures should:

  • Accept parameters to reduce SQL injection risks.
  • Include error handling to gracefully manage failures.

The other choices introduce security or reliability issues.


Question 3 (Single Answer)

A developer needs to create a database object that automatically returns only rows belonging to the current user.

Which SQL feature should be used?

A. Dynamic Data Masking

B. Row-Level Security

C. Transparent Data Encryption

D. Columnstore Index

Answer: B

Explanation

Row-Level Security (RLS) controls which rows a user can access.

Example:

A salesperson should only see customers assigned to their territory.

Why the others are incorrect:

  • Dynamic Data Masking hides values but does not filter rows.
  • TDE encrypts data at rest.
  • Columnstore indexes improve analytics performance.

Question 4 (Fill in the Blank)

Complete the statement.

The SQL Server feature that stores historical query execution information and helps identify performance regressions is:

A. Query Store

B. Resource Governor

C. SQL Server Agent

D. Database Mail

Answer: A

Explanation

Query Store captures:

  • Query text
  • Execution plans
  • Runtime statistics

It is commonly used after deployments to determine whether performance has degraded.


Question 5 (Scenario-Based)

A company has a customer table containing:

  • CustomerID
  • Name
  • EmailAddress
  • PhoneNumber

Customer service representatives need to search customers by name and email.

The application frequently executes:

SELECT *
FROM Customers
WHERE EmailAddress = @Email;

The query is slow.

What should you implement?

A. A nonclustered index on EmailAddress.

B. A clustered columnstore index.

C. Database encryption.

D. A JSON document store.

Answer: A

Explanation

A nonclustered index on EmailAddress allows efficient searches using the predicate.

The query optimizer can perform an index seek instead of scanning the entire table.


Question 6 (Matching)

Match each SQL feature with its purpose.

FeaturePurpose
1. Dynamic Data MaskingA. Encrypts database files
2. Transparent Data EncryptionB. Filters rows returned to users
3. Row-Level SecurityC. Hides sensitive column values

Answer

FeatureCorrect Match
Dynamic Data MaskingC
Transparent Data EncryptionA
Row-Level SecurityB

Explanation

  • DDM masks sensitive data.
  • TDE protects stored database files.
  • RLS restricts row visibility.

Question 7 (Scenario-Based)

A company wants to deploy schema changes automatically.

The development team uses Visual Studio SQL Database Projects.

The deployment process must:

  • Detect schema conflicts before deployment.
  • Store database changes in source control.
  • Deploy only approved changes.

Which solution should be implemented?

A. Manually copy SQL scripts to production.

B. Use a CI/CD pipeline with SQL Database Projects.

C. Allow developers to modify production directly.

D. Disable schema validation.

Answer: B

Explanation

SQL Database Projects integrate well with CI/CD pipelines.

Benefits include:

  • Version control.
  • Automated builds.
  • Schema validation.
  • Repeatable deployments.

Question 8 (Choose THREE)

A developer is designing a vector search solution.

Which THREE practices improve search quality?

A. Generate embeddings using a suitable AI model.

B. Select an appropriate similarity metric.

C. Split large documents into meaningful chunks.

D. Convert embeddings into XML.

E. Disable indexing.

Choose THREE answers.

Answers

A

B

C

Explanation

Vector search quality depends on:

  • Good embeddings.
  • Proper chunking.
  • Appropriate similarity calculations.

Converting vectors to XML or disabling indexes reduces effectiveness.


Question 9 (Scenario-Based)

A developer implements a Retrieval-Augmented Generation application.

The application workflow is:

  1. User asks a question.
  2. The system searches documents.
  3. Relevant documents are added to the prompt.
  4. The language model generates an answer.

Users report incorrect answers when documents contain outdated information.

What should be improved?

A. Increase the language model temperature.

B. Ensure document updates regenerate embeddings and refresh the vector index.

C. Remove retrieval from the architecture.

D. Increase SQL transaction isolation.

Answer: B

Explanation

RAG depends on accurate retrieval.

When documents change:

  1. Generate new embeddings.
  2. Update vector storage.
  3. Ensure the search index contains current data.

Question 10 (Single Answer)

A developer wants to retrieve a scalar value from JSON returned by an AI service.

Which SQL function should be used?

A. OPENJSON

B. JSON_QUERY

C. JSON_VALUE

D. FOR JSON PATH

Answer: C

Explanation

JSON_VALUE extracts a single scalar value.

Example:

SELECT JSON_VALUE(@json,'$.answer');

Other functions:

  • OPENJSON converts JSON into rows.
  • JSON_QUERY returns JSON objects or arrays.
  • FOR JSON PATH creates JSON output.

Question 11 (Scenario-Based)

A company has an application that retrieves customer order history.

The following query is executed frequently:

SELECT OrderDate, Amount
FROM Orders
WHERE CustomerID = @CustomerID
ORDER BY OrderDate DESC;

The query is slow because the Orders table contains several hundred million rows.

Which index should you create?

A. A nonclustered index on CustomerID that includes OrderDate and Amount.

B. A clustered columnstore index on the Orders table.

C. A unique constraint on OrderDate.

D. A full-text index on CustomerID.

Answer: A

Explanation

A covering nonclustered index improves this query because:

  • CustomerID is used for filtering.
  • OrderDate supports sorting.
  • Amount is included to avoid additional lookups.

A clustered columnstore index is better suited for analytical workloads.


Question 12 (Choose TWO)

A database developer is writing complex T-SQL code.

Which TWO practices improve maintainability and performance?

A. Use Common Table Expressions (CTEs) when appropriate.

B. Avoid all stored procedures.

C. Use execution plans to analyze queries.

D. Store all business logic in application code.

E. Ignore query statistics.

Choose TWO answers.

Answers

A

C

Explanation

Good T-SQL practices include:

  • Using CTEs to simplify complex queries.
  • Reviewing execution plans to identify bottlenecks.

Execution plans reveal:

  • Table scans
  • Missing indexes
  • Expensive operators

Question 13 (Single Answer)

A company wants to prevent users from viewing sensitive information while allowing applications to access the original values securely.

Which feature should be considered?

A. Dynamic Data Masking

B. Always Encrypted

C. Columnstore Index

D. Query Store

Answer: B

Explanation

Always Encrypted protects sensitive data from being exposed to database administrators or unauthorized users.

Encryption and decryption occur outside the database engine.

Comparison:

  • DDM masks values but privileged users can access original data.
  • TDE protects data at rest.
  • Query Store tracks performance.

Question 14 (Scenario-Based)

A developer creates a stored procedure that dynamically builds SQL statements:

SET @sql =
'SELECT * FROM Customers WHERE Name = '''
+ @Name + '''';
EXEC(@sql);

Security testing identifies a SQL injection vulnerability.

What should the developer do?

A. Use parameterized SQL with sp_executesql.

B. Encrypt the database.

C. Add more indexes.

D. Enable Query Store.

Answer: A

Explanation

Dynamic SQL that concatenates user input can allow SQL injection.

Using:

sp_executesql

with parameters separates:

  • SQL code
  • User-provided values

This improves security and query plan reuse.


Question 15 (Fill in the Blank)

Complete the statement.

A vector search system stores numerical representations of data called __________ that capture semantic meaning.

A. Tokens

B. Embeddings

C. Transactions

D. Partitions

Answer: B

Explanation

Embeddings are numerical vectors generated by AI models.

They allow systems to compare similarity between:

  • Documents
  • Images
  • Questions
  • Other data types

Question 16 (Matching)

Match each Azure SQL AI capability with its purpose.

CapabilityPurpose
1. Vector SearchA. Generates natural language responses
2. EmbeddingsB. Finds semantically similar data
3. Language ModelC. Represents data as numerical vectors

Answer

CapabilityCorrect Match
Vector SearchB
EmbeddingsC
Language ModelA

Explanation

The components work together:

  1. Embeddings convert data into vectors.
  2. Vector search finds similar vectors.
  3. Language models generate responses.

Question 17 (Choose THREE)

A company is optimizing an Azure SQL Database workload.

Which THREE actions can improve query performance?

A. Create appropriate indexes.

B. Review execution plans.

C. Update outdated statistics.

D. Disable all constraints.

E. Remove all indexes.

Choose THREE answers.

Answers

A

B

C

Explanation

Performance optimization commonly includes:

  • Proper indexing.
  • Execution plan analysis.
  • Maintaining statistics.

Removing indexes or disabling constraints generally reduces database quality.


Question 18 (Scenario-Based)

A company wants to create an AI assistant that answers employee questions about internal policies.

The company wants answers based only on approved documents.

Which architecture should be implemented?

A. Store all documents directly inside the language model.

B. Use Retrieval-Augmented Generation with document retrieval.

C. Increase the model temperature.

D. Remove document indexing.

Answer: B

Explanation

RAG provides:

  • External knowledge retrieval.
  • Grounded prompts.
  • Updated information without retraining.

The model receives relevant documents as context when generating responses.


Question 19 (Scenario-Based)

A developer implements hybrid search.

The system performs:

  • Keyword search using SQL full-text capabilities.
  • Vector similarity search using embeddings.

The developer needs to merge both ranked result sets.

Which technique should be used?

A. Reciprocal Rank Fusion

B. Data compression

C. Database normalization

D. Horizontal partitioning

Answer: A

Explanation

Reciprocal Rank Fusion (RRF):

  • Combines multiple ranked lists.
  • Does not require matching score scales.
  • Improves hybrid search relevance.

Question 20 (Choose TWO)

A developer sends SQL data to an external language model.

Which TWO practices should be followed?

A. Remove unnecessary sensitive information before sending prompts.

B. Include all database columns to maximize context.

C. Validate and sanitize generated responses.

D. Disable access controls for AI applications.

E. Store API keys directly in application code.

Choose TWO answers.

Answers

A

C

Explanation

Secure AI implementations should:

  • Minimize data exposure.
  • Validate AI outputs.

Avoid:

  • Sending unnecessary data.
  • Hardcoding secrets.
  • Removing security controls.

Question 21 (Scenario-Based)

A development team is building an AI-powered customer support assistant.

The architecture includes:

  • Azure SQL Database containing product documentation
  • Vector embeddings stored with documents
  • A language model generating answers

Users report that the assistant provides inaccurate answers when documents are updated.

What should the development team implement?

A. Increase the language model temperature.

B. Regenerate embeddings and update the vector index whenever documents change.

C. Increase the size of the language model.

D. Remove vector search and use keyword search only.

Answer: B

Explanation

In a RAG solution, document updates require:

  1. Updating the source data.
  2. Regenerating embeddings.
  3. Updating the vector index.

The language model does not automatically learn from updated documents.


Question 22 (Choose TWO)

A developer is designing a vector search implementation.

Which TWO factors should be evaluated when choosing a vector index strategy?

A. Number of vectors stored.

B. Database user roles.

C. Search latency requirements.

D. Column naming conventions.

E. Stored procedure naming standards.

Choose TWO answers.

Answers

A

C

Explanation

Vector search performance depends on:

  • The size of the vector collection.
  • Required query response times.

Other factors listed do not directly affect vector index selection.


Question 23 (Single Answer)

A developer wants to compare the meaning of two pieces of text instead of comparing exact words.

Which approach should be used?

A. String comparison functions

B. Vector embeddings with similarity search

C. Database triggers

D. Data compression

Answer: B

Explanation

Vector embeddings represent semantic meaning numerically.

Similarity searches can identify related concepts even when the wording differs.

Example:

“automobile repair”

and

“vehicle maintenance”

may be considered similar.


Question 24 (Scenario-Based)

A company creates an AI assistant that uses RAG.

The prompt sent to the language model contains:

  • User question
  • Retrieved documents
  • Instructions

The developer wants the model to answer only from retrieved documents.

Which prompt design approach should be used?

A. Tell the model to use provided context and avoid unsupported answers.

B. Remove retrieved documents from the prompt.

C. Increase randomness using a higher temperature.

D. Include unrelated database information.

Answer: A

Explanation

A well-designed RAG prompt should:

  • Provide relevant context.
  • Define response rules.
  • Reduce hallucinations.

Example instruction:

“Answer only using the supplied documents. If the answer is not present, state that you do not know.”


Question 25 (Ordering)

Arrange the following steps for creating a RAG application.

  1. Generate embeddings for documents.
  2. Retrieve relevant documents.
  3. Store document embeddings.
  4. Send augmented prompt to the language model.
  5. Combine retrieved content with the user question.

Correct Order

1 → 3 → 2 → 5 → 4

Explanation

A typical RAG workflow:

  1. Convert documents into embeddings.
  2. Store vectors in a vector-enabled database.
  3. Search vectors when a user asks a question.
  4. Add retrieved content to the prompt.
  5. Send the prompt to the language model.

Question 26 (Matching)

Match each SQL JSON function with its purpose.

FunctionPurpose
1. JSON_VALUEA. Returns JSON objects or arrays
2. JSON_QUERYB. Converts JSON elements into rows
3. OPENJSONC. Extracts scalar JSON values

Answer

FunctionCorrect Match
JSON_VALUEC
JSON_QUERYA
OPENJSONB

Explanation

SQL Server JSON functions:

JSON_VALUE

  • Retrieves a single scalar value.

JSON_QUERY

  • Retrieves JSON objects or arrays.

OPENJSON

  • Converts JSON data into relational rows.

Question 27 (Choose THREE)

A company is preparing an enterprise AI application using Azure SQL Database.

Which THREE security practices should be implemented?

A. Use managed identities where possible.

B. Apply least-privilege database permissions.

C. Log and monitor AI application activity.

D. Store API keys in source code.

E. Send all customer data to the model.

Choose THREE answers.

Answers

A

B

C

Explanation

Enterprise AI applications should follow security best practices:

  • Managed identities reduce credential exposure.
  • Least privilege limits access.
  • Monitoring supports auditing and governance.

Avoid:

  • Hardcoded credentials.
  • Sending unnecessary sensitive information.

Question 28 (Scenario-Based)

A developer uses:

EXEC sp_invoke_external_rest_endpoint

to call an external AI service.

The request fails with HTTP status code 401.

What is the most likely issue?

A. The AI service returned too many results.

B. Authentication credentials are missing or invalid.

C. The database has insufficient storage.

D. The prompt contains too many tokens.

Answer: B

Explanation

HTTP 401 means:

Unauthorized

Common causes:

  • Missing authentication headers.
  • Invalid credentials.
  • Expired tokens.

Other common HTTP codes:

  • 400 = Bad request.
  • 429 = Too many requests.
  • 500 = Server error.

Question 29 (Scenario-Based)

A company has implemented hybrid search.

The results from keyword search and vector search have different scoring systems.

The team needs to combine the results without manually normalizing scores.

Which approach should be used?

A. Reciprocal Rank Fusion

B. Increase vector dimensions

C. Remove keyword search

D. Use a larger database transaction log

Answer: A

Explanation

Reciprocal Rank Fusion (RRF):

  • Combines ranked lists.
  • Works even when scoring methods differ.
  • Improves hybrid search relevance.

Example:

Keyword search ranking:

  1. Document A
  2. Document B

Vector search ranking:

  1. Document C
  2. Document A

RRF combines these rankings into a unified result list.


Question 30 (Comprehensive Scenario)

A company is building an AI knowledge assistant.

Requirements:

  • Data is stored in Azure SQL Database.
  • Users ask questions using natural language.
  • The system must find relevant information even when wording differs.
  • Exact identifiers such as policy numbers must still work.
  • Responses must be based on company documents.
  • New documents must be available without retraining the AI model.

Which architecture should be implemented?

A. Traditional SQL queries only.

B. Fine-tune the language model whenever documents change.

C. RAG using embeddings, vector search, hybrid search, and prompt augmentation.

D. Export all database content into the language model.

Answer: C

Explanation

The recommended architecture is:

  1. Store documents in Azure SQL Database.
  2. Generate embeddings.
  3. Store embeddings for vector search.
  4. Perform hybrid search:
    • Keyword search handles exact terms.
    • Vector search handles semantic meaning.
  5. Use RRF to merge rankings.
  6. Add retrieved information to the prompt.
  7. Generate a grounded response.

Benefits:

  • Updated information without model retraining.
  • Better accuracy.
  • Reduced hallucination.
  • Improved search relevance.

Go to the DP-800 Exam Prep Hub main page

DP-800 Practice Exam #4 (30 questions)

This post/practice exam is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.


Question 1 (Scenario-Based)

A financial services company is designing a transaction database.

The database must:

  • Process thousands of transactions per second.
  • Support frequent inserts and updates.
  • Retrieve transactions by TransactionID.
  • Maintain strong transactional consistency.

Which table design should you recommend?

A. Create a clustered index on TransactionID.

B. Create a clustered columnstore index on the transaction table.

C. Store transactions as JSON documents.

D. Create indexes only after performance issues occur.


Answer: A

Explanation

A clustered index on a transaction key is appropriate for an OLTP workload.

Benefits:

  • Fast lookups by TransactionID.
  • Efficient storage organization.
  • Good support for inserts and updates.

Why other answers are incorrect:

  • B: Columnstore indexes are optimized for analytics and large scans.
  • C: JSON storage is not ideal for transactional relational workloads.
  • D: Index design should be planned during database development.

Question 2 (Choose TWO)

A developer is creating a SQL stored procedure used by multiple applications.

Which TWO practices should be implemented?

A. Use parameters instead of concatenating user input.

B. Grant applications direct access to every database table.

C. Implement TRY…CATCH error handling.

D. Disable transaction handling.

E. Store database credentials inside the procedure.

Choose TWO answers.


Answers:

✅ A
✅ C

Explanation

Stored procedures should:

  • Use parameters to prevent SQL injection.
  • Include error handling to manage failures.

Incorrect approaches:

  • Direct table access violates security principles.
  • Credentials should never be stored in code.
  • Transactions should be managed appropriately.

Question 3 (Single Answer)

A company needs to prevent users from seeing specific rows in a table based on their department.

Which feature should be implemented?

A. Dynamic Data Masking

B. Row-Level Security

C. Transparent Data Encryption

D. Always Encrypted


Answer: B

Explanation

Row-Level Security (RLS) controls which rows users can access.

Example:

A sales employee can view only customers assigned to their region.

Comparison:

FeaturePurpose
Dynamic Data MaskingHides column values
RLSFilters rows
TDEEncrypts data at rest
Always EncryptedProtects sensitive data from database administrators

Question 4 (Fill in the Blank)

Complete the statement.

The SQL feature that allows developers to analyze historical query execution plans and runtime statistics is:

A. Query Store

B. SQL Server Agent

C. Database Mail

D. Resource Governor


Answer: A

Explanation

Query Store captures:

  • Query text
  • Execution plans
  • Runtime statistics
  • Performance history

It is commonly used to troubleshoot regressions after deployments.


Question 5 (Scenario-Based)

An e-commerce company has a Products table.

The following query is executed frequently:

SELECT ProductName, Price
FROM Products
WHERE CategoryID = 25;

The table contains 200 million rows.

The query currently performs a full table scan.

What should you implement?

A. A nonclustered index on CategoryID.

B. Transparent Data Encryption.

C. Convert the table into XML.

D. Increase the database recovery model.


Answer: A

Explanation

A nonclustered index allows SQL Server to locate products by CategoryID without scanning the entire table.

The other options do not improve query lookup performance.


Question 6 (Matching)

Match each feature with its purpose.

FeaturePurpose
1. Query StoreA. Encrypts stored database files
2. Transparent Data EncryptionB. Tracks query performance history
3. Dynamic Data MaskingC. Hides sensitive column values

Answer

FeatureMatch
Query StoreB
Transparent Data EncryptionA
Dynamic Data MaskingC

Explanation

  • Query Store helps analyze query performance.
  • TDE encrypts data files.
  • DDM masks sensitive values.

Question 7 (Scenario-Based)

A development team manages SQL schemas using SQL Database Projects.

The team requires:

  • Database changes stored in Git.
  • Automated validation before deployment.
  • Repeatable deployments across environments.

Which approach should be used?

A. Manually execute scripts in production.

B. Use SQL Database Projects with a CI/CD pipeline.

C. Allow developers to change production directly.

D. Store scripts only on local computers.


Answer: B

Explanation

SQL Database Projects support modern database DevOps practices:

  • Source control integration.
  • Automated builds.
  • Schema validation.
  • Deployment automation.

Question 8 (Choose THREE)

A company is building a semantic search application.

Which THREE components are required?

A. An embedding model

B. Vector storage

C. Similarity search

D. Database Mail

E. SQL Server Agent jobs

Choose THREE answers.


Answers:

✅ A
✅ B
✅ C

Explanation

Semantic search requires:

  1. Converting content into embeddings.
  2. Storing those vectors.
  3. Searching vectors based on similarity.

Database Mail and SQL Server Agent are unrelated.


Question 9 (Scenario-Based)

A company has implemented Retrieval-Augmented Generation (RAG).

The application retrieves documents but sometimes produces incorrect answers.

The retrieved documents are accurate.

What should the developer review first?

A. The prompt instructions sent to the language model.

B. The database backup schedule.

C. The database file size.

D. The transaction isolation level.


Answer: A

Explanation

When retrieval is correct but answers are incorrect, the prompt design should be reviewed.

The prompt should:

  • Clearly define the task.
  • Include retrieved context.
  • Instruct the model to use provided information.

Question 10 (Single Answer)

A developer receives this JSON response from an AI service:

{
"answer": "The policy expires after one year."
}

Which SQL function should extract the answer value?

A. JSON_QUERY

B. OPENJSON

C. JSON_VALUE

D. FOR JSON PATH


Answer: C

Explanation

JSON_VALUE extracts scalar values from JSON.

Example:

SELECT JSON_VALUE(@response,'$.answer');

Other functions:

  • JSON_QUERY returns objects or arrays.
  • OPENJSON converts JSON into rows.
  • FOR JSON PATH creates JSON output.

Question 11 (Scenario-Based)

A company has an Azure SQL Database containing customer activity data.

The following query is executed frequently:

SELECT
CustomerID,
LastLoginDate,
AccountStatus
FROM Customers
WHERE CustomerID = @CustomerID;

The query execution plan shows an expensive key lookup operation.

What should you do to improve performance?

A. Create a covering nonclustered index that includes LastLoginDate and AccountStatus.

B. Remove all indexes from the table.

C. Convert the table to a clustered columnstore table.

D. Enable Transparent Data Encryption.


Answer: A

Explanation

A covering index contains all columns needed by the query.

Example:

CREATE INDEX IX_Customers_CustomerID
ON Customers(CustomerID)
INCLUDE (LastLoginDate, AccountStatus);

This allows SQL Server to retrieve all required data directly from the index without performing additional lookups.

Incorrect answers:

  • B: Removing indexes reduces performance.
  • C: Columnstore indexes are designed for analytics.
  • D: Encryption does not improve query performance.

Question 12 (Choose TWO)

A developer wants to improve the reliability of database application code.

Which TWO practices should be implemented?

A. Use explicit transactions when multiple operations must succeed together.

B. Ignore transaction failures because SQL Server automatically retries everything.

C. Use appropriate error handling.

D. Store business logic only in client applications.

E. Remove constraints to improve performance.

Choose TWO answers.


Answers:

✅ A
✅ C

Explanation

Reliable database applications use:

  • Transactions for atomic operations.
  • Error handling to properly manage failures.

Incorrect:

  • SQL Server does not automatically handle all failures.
  • Constraints protect data integrity.
  • Business logic can exist in stored procedures when appropriate.

Question 13 (Single Answer)

A company needs to ensure that database administrators cannot view sensitive customer information.

Which feature provides the strongest protection?

A. Dynamic Data Masking

B. Always Encrypted

C. Row-Level Security

D. Transparent Data Encryption


Answer: B

Explanation

Always Encrypted protects sensitive data from being viewed by the database engine or administrators.

Comparison:

FeatureProtection
Dynamic Data MaskingHides displayed values
RLSRestricts rows
TDEEncrypts database files
Always EncryptedProtects data from unauthorized database access

Question 14 (Scenario-Based)

A developer notices a query performs poorly.

The execution plan shows:

  • A table scan
  • A missing index recommendation
  • High logical reads

What should the developer do first?

A. Review the query execution plan and evaluate appropriate indexing.

B. Increase the language model temperature.

C. Enable database encryption.

D. Convert relational tables into JSON.


Answer: A

Explanation

Execution plans identify:

  • Expensive operators.
  • Missing indexes.
  • Inefficient query patterns.

The correct optimization process is to analyze the workload before making changes.


Question 15 (Fill in the Blank)

Complete the statement.

The process of combining keyword search results with vector search results is called:

A. Data normalization

B. Hybrid search

C. Data partitioning

D. Tokenization


Answer: B

Explanation

Hybrid search combines:

  • Lexical search (keywords)
  • Semantic search (vectors)

This improves retrieval accuracy because both exact matching and meaning are considered.


Question 16 (Matching)

Match each AI search concept with its purpose.

ConceptPurpose
1. EmbeddingA. Combines multiple ranked searches
2. Reciprocal Rank FusionB. Converts content into vectors
3. Vector SearchC. Finds similar content based on vectors

Answer

ConceptMatch
EmbeddingB
Reciprocal Rank FusionA
Vector SearchC

Explanation

  • Embeddings represent content numerically.
  • Vector search finds semantically similar information.
  • RRF combines ranked lists from multiple retrieval methods.

Question 17 (Choose THREE)

A company is securing an AI-enabled database application.

Which THREE actions should be implemented?

A. Use managed identities for Azure resources.

B. Apply least-privilege access.

C. Remove unnecessary sensitive data from prompts.

D. Share database administrator credentials with developers.

E. Disable auditing.

Choose THREE answers.


Answers:

✅ A
✅ B
✅ C

Explanation

Secure AI solutions should:

  • Minimize credential exposure.
  • Restrict permissions.
  • Reduce sensitive information sent to AI services.

Incorrect:

  • Shared administrator credentials violate security principles.
  • Auditing supports governance and compliance.

Question 18 (Scenario-Based)

A developer creates a RAG solution.

The retrieval process returns:

  • Product manuals
  • Customer reviews
  • Internal notes

The language model frequently references customer reviews instead of official manuals.

What should the developer implement?

A. Increase the number of unrelated documents retrieved.

B. Improve retrieval filtering and document ranking.

C. Remove all vector embeddings.

D. Disable prompt instructions.


Answer: B

Explanation

RAG quality depends on retrieval quality.

Possible improvements:

  • Metadata filtering.
  • Better ranking.
  • Improved chunking.
  • Adjusted retrieval parameters.

The model can only use the information it receives.


Question 19 (Scenario-Based)

A developer calls an Azure AI service from SQL Server using:

sp_invoke_external_rest_endpoint

The request returns HTTP status code 429.

What should the developer implement?

A. Retry logic with exponential backoff.

B. Change JSON_VALUE to JSON_QUERY.

C. Remove authentication.

D. Disable vector indexing.


Answer: A

Explanation

HTTP 429 means:

Too Many Requests

The service is throttling requests.

Recommended approach:

  • Retry after a delay.
  • Use exponential backoff.
  • Monitor service limits.

Question 20 (Choose TWO)

A developer is designing prompts for a RAG application.

Which TWO practices improve response quality?

A. Include relevant retrieved context.

B. Provide clear instructions about expected responses.

C. Include every database table in every prompt.

D. Remove grounding information.

E. Maximize prompt size regardless of relevance.

Choose TWO answers.


Answers:

✅ A
✅ B

Explanation

Effective prompts:

  • Provide relevant context.
  • Clearly define expected behavior.

Large amounts of irrelevant information can reduce response quality and increase cost.


Question 21 (Scenario-Based)

A company stores product descriptions as vector embeddings in Azure SQL Database.

The search application needs to find products with similar meanings even when users use different words.

Example:

User query:

“waterproof hiking footwear”

Relevant products:

“weather-resistant trail boots”

Which similarity approach should be used?

A. Exact string comparison

B. Vector similarity search

C. Foreign key lookup

D. Transaction log analysis


Answer: B

Explanation

Vector similarity search compares numerical representations of meaning rather than exact words.

Embeddings allow the system to identify semantic relationships between concepts.

Incorrect:

  • String comparison requires exact matches.
  • Foreign keys are relational integrity features.
  • Transaction logs are unrelated to search.

Question 22 (Choose TWO)

A developer is evaluating vector search performance.

Which TWO metrics are important when assessing a vector search implementation?

A. Search relevance

B. Number of database users

C. Query latency

D. Stored procedure naming conventions

E. Database object ownership

Choose TWO answers.


Answers:

✅ A
✅ C

Explanation

Vector search performance is evaluated using:

Search relevance

Measures whether returned results are meaningful.

Query latency

Measures how quickly results are returned.

Other options do not measure vector search quality.


Question 23 (Scenario-Based)

A company implements hybrid search.

The keyword search engine returns:

RankDocument
1Document A
2Document B

The vector search engine returns:

RankDocument
1Document C
2Document A

The company wants to combine rankings without comparing incompatible relevance scores.

Which technique should be used?

A. Reciprocal Rank Fusion

B. Database normalization

C. Index fragmentation

D. Data compression


Answer: A

Explanation

Reciprocal Rank Fusion (RRF):

  • Combines ranked lists.
  • Does not require score normalization.
  • Improves hybrid search results.

RRF assigns higher weight to documents appearing near the top of multiple rankings.


Question 24 (Matching)

Match each search technology with its best use case.

TechnologyUse Case
1. Keyword searchA. Finding similar concepts
2. Vector searchB. Exact identifiers
3. Hybrid searchC. Combining semantic and lexical retrieval

Answer

TechnologyMatch
Keyword searchB
Vector searchA
Hybrid searchC

Explanation

Keyword search:

  • Best for exact terms.
  • Example: product numbers, policy IDs.

Vector search:

  • Best for semantic similarity.

Hybrid search:

  • Combines both approaches.

Question 25 (Ordering)

Arrange the steps for implementing a RAG solution.

  1. Generate embeddings for source documents.
  2. Retrieve relevant documents using search.
  3. Store embeddings in a vector-enabled database.
  4. Add retrieved information to the prompt.
  5. Send the prompt to the language model.

Correct Order:

1 → 3 → 2 → 4 → 5

Explanation

A typical RAG workflow:

Step 1

Documents are converted into embeddings.

Step 2

Embeddings are stored.

Step 3

A user query retrieves similar content.

Step 4

Retrieved information is added to the prompt.

Step 5

The language model generates a response.


Question 26 (Scenario-Based)

A developer creates a RAG chatbot.

Users complain that answers contain information that is not in company documents.

Which improvement should be implemented?

A. Add stronger grounding instructions in the prompt.

B. Increase the temperature value.

C. Remove retrieved documents from the prompt.

D. Increase database transaction isolation.


Answer: A

Explanation

This problem is called hallucination.

Reducing hallucination requires:

  • Better grounding.
  • Clear prompt instructions.
  • Restricting responses to retrieved information.

Example:

“Answer only using the provided documents.”


Question 27 (Single Answer)

A developer receives this response from an AI service:

{
"response": {
"text": "Your request was approved."
}
}

Which SQL function should be used to retrieve the nested text value?

A. JSON_VALUE

B. JSON_QUERY

C. OPENXML

D. STRING_SPLIT


Answer: A

Explanation

JSON_VALUE extracts scalar values.

Example:

SELECT JSON_VALUE(
@json,
'$.response.text'
);

Other functions:

  • JSON_QUERY returns JSON objects or arrays.
  • STRING_SPLIT separates text values.
  • OPENXML is an XML function.

Question 28 (Choose THREE)

A company is designing an enterprise RAG application.

Which THREE design considerations should be implemented?

A. Chunk documents into meaningful sections.

B. Generate embeddings using an appropriate model.

C. Store retrieved documents with metadata.

D. Include every document in every prompt.

E. Ignore document updates.

Choose THREE answers.


Answers:

✅ A
✅ B
✅ C

Explanation

High-quality RAG systems require:

Chunking

Improves retrieval precision.

Embeddings

Enable semantic matching.

Metadata

Supports filtering and ranking.

Incorrect:

  • Sending all documents increases cost and reduces relevance.
  • Updated documents require embedding refreshes.

Question 29 (Scenario-Based)

A developer creates an AI-enabled SQL application.

The application sends customer information to an external language model.

The company requires that only necessary information is shared.

What should the developer implement?

A. Data minimization before sending prompts.

B. Disable encryption.

C. Store API keys in application code.

D. Send the entire database schema.


Answer: A

Explanation

Data minimization is a key AI security practice.

The application should:

  • Send only required information.
  • Remove unnecessary sensitive data.
  • Protect customer privacy.

Incorrect:

  • API keys should not be embedded in code.
  • Encryption should not be disabled.
  • Sending unnecessary data increases risk.

Question 30 (Comprehensive Scenario-Based)

A company is building an AI-powered knowledge assistant using Azure SQL Database.

Requirements:

  • Users ask natural language questions.
  • The assistant must answer using company documents.
  • Exact product codes must be searchable.
  • Similar concepts must also be discovered.
  • Documents are updated frequently.
  • The AI model should not require retraining.

Which architecture should be implemented?

A. Traditional relational queries only.

B. Fine-tune the language model every time documents change.

C. RAG using embeddings, hybrid search, and prompt augmentation.

D. Export all company data directly into the language model.


Answer: C

Explanation

The correct architecture is a Retrieval-Augmented Generation (RAG) solution.

The design should include:

Data preparation

  • Split documents into chunks.
  • Generate embeddings.
  • Store vectors.

Search

  • Use vector search for semantic matching.
  • Use keyword search for exact values.
  • Combine results using hybrid search and RRF.

Generation

  • Add retrieved context to prompts.
  • Send grounded prompts to the language model.

Benefits:

✅ Updated information without retraining
✅ Better accuracy
✅ Reduced hallucinations
✅ Supports enterprise search scenarios


Go to the DP-800 Exam Prep Hub main page

Exam Prep Hub for DP-800: Developing AI-Enabled Database Solutions

Welcome to the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub!

Welcome to the one-stop hub with information for preparing for the DP-800: Developing AI-Enabled Database Solutions certification exam. The content for this exam helps prepare you to have “subject matter expertise in designing and developing AI-enabled database solutions across Microsoft SQL platforms, including Microsoft SQL Server, Azure SQL, and SQL databases in Microsoft Fabric”.
Upon successful completion of the exam, you earn the Microsoft Certified: SQL AI Developer Associate 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 DP-800 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 subject matter expertise in designing and developing AI-enabled database solutions across Microsoft SQL platforms, including Microsoft SQL Server, Azure SQL, and SQL databases in Microsoft Fabric.
You should also have experience writing T-SQL code and developing databases in Microsoft SQL platforms. Plus, you need to be familiar with continuous integration and continuous deployment (CI/CD) practices in GitHub, AI-assisted development tools, and AI concepts, such as embeddings, vectors, and models.
Your responsibilities include:
- Designing and developing database solutions that include both structured and semi-structured data.
- Integrating AI features into modern and highly scalable enterprise applications.
- Securing, optimizing, and deploying database solutions.
- Implementing AI capabilities in database solutions.
You work closely with application developers; database administrators (DBAs); architects; AI engineers; development, security, operations (DevSecOps) engineers; security and compliance administrators; and other stakeholders to deliver robust, high-performance database solutions that power modern applications and AI-driven experiences.

Skills at a glance (as specified in the official study guide)

  • Design and develop database solutions (35–40%)
  • Secure, optimize, and deploy database solutions (35–40%)
  • Implement AI capabilities in database solutions (25–30%)


Topic-by-Topic Exam Content

[click a topic link to access the content and practice questions for that topic]

Design and develop database solutions (35–40%)

Design and implement database objects

Implement programmability objects

Write advanced T-SQL code

Design and implement SQL solutions by using AI-assisted tools

Secure, optimize, and deploy database solutions (35–40%)

Implement data security and compliance

Optimize database performance

Implement CI/CD by using SQL Database Projects

Integrate SQL solutions with Azure services

Implement AI capabilities in database solutions (25–30%)

Design and implement models and embeddings

Design and implement intelligent search

Design and implement retrieval-augmented generation (RAG)


DP-800 Practice Exams


Important DP-800 Resources

Link to the free, comprehensive, self-paced course on Microsoft Learn:
Course: Develop AI-enabled database solutions

Course DP-800T00-A: Develop AI-enabled database solutions – Training | Microsoft Learn

This course has 3 learning paths. The 3 learning paths and their modules are listed with links below:

(1) Design and develop database solutions

This learning path has 4 modules:
(i) Design and implement database objects with SQL
(ii) Implement programmability objects with SQL
(iii) Write advanced T-SQL code
(iv) Implement SQL solutions by using AI-assisted tools

(2) Secure, optimize, and deploy database solutions

This learning path has 4 modules:
(i) Implement data security and compliance with SQL
(ii) Optimize database performance
(iii) Implement CI/CD by using SQL Database Projects
(iv) Integrate SQL solutions with Azure services

(3) Implement AI capabilities in database solutions

This learning path has 3 modules:
(i) Design and implement models and embeddings with SQL
(ii) Design and implement intelligent search with SQL
(iii) Design and implement RAG with SQL

Link to the certification page:

Link to the “Microsoft Certified: SQL AI Developer Associate” certification page:
https://learn.microsoft.com/en-us/credentials/certifications/developing-ai-enabled-database-solutions/?practice-assessment-type=certification

Link to the study guide:

Link to the Study Guide for DP-800: Developing AI-Enabled Database Solutions:
https://learn.microsoft.com/en-us/credentials/certifications/resources/study-guides/dp-800

YouTube resources:

Get Certified: SQL AI Developer (DP-800) series by Microsoft Reactor

Courses:

These are two highly rated courses for DP-800 on Udemy:


Good luck to you passing the DP-800 Exam!
However, the more preparation you have, the less luck you will need. 🙂

Visit this post to see the list of all the certification preparation hubs available on The Data Community.

Handle changes by using change event streaming (CES), change data capture (CDC), Change Tracking, Azure Functions with SQL trigger binding, or Azure Logic Apps (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Secure, optimize, and deploy database solutions (35–40%)
   --> Integrate SQL solutions with Azure services
      --> Handle changes by using change event streaming (CES), change data capture (CDC), Change Tracking, Azure Functions with SQL trigger binding, or Azure Logic Apps


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 applications rarely operate in isolation. A single database update often needs to trigger downstream actions such as updating search indexes, synchronizing data warehouses, refreshing caches, sending notifications, invoking APIs, or triggering AI pipelines.

Microsoft SQL Server and Azure SQL provide several mechanisms to detect and react to data changes. The DP-800 exam expects candidates to understand the capabilities, strengths, limitations, and appropriate use cases for each technology.

The primary technologies include:

  • Change Data Capture (CDC)
  • Change Tracking
  • Change Event Streaming (CES)
  • Azure Functions with SQL Trigger Binding
  • Azure Logic Apps

Understanding when and why to use each technology is more important than memorizing implementation details.


Why Change Detection Matters

Applications often need to know when data changes occur without continuously querying every table.

Examples include:

  • Synchronizing CRM and ERP systems
  • Triggering AI workflows after new customer data arrives
  • Updating recommendation engines
  • Refreshing search indexes
  • Sending order confirmation emails
  • Replicating data into Microsoft Fabric
  • Populating analytical data lakes
  • Updating Power BI semantic models

Without an efficient change detection mechanism, applications would have to repeatedly scan entire tables, resulting in:

  • Poor performance
  • Increased costs
  • Higher latency
  • Unnecessary resource utilization

Overview of Available Technologies

TechnologyDetects InsertsUpdatesDeletesProvides Changed ValuesTypical Use
Change TrackingYesYesYesNoLightweight synchronization
Change Data CaptureYesYesYesYesETL and replication
Change Event StreamingYesYesYesEvent streamEvent-driven architectures
Azure Functions SQL TriggerYesYesYesCurrent rowServerless processing
Azure Logic AppsYesYesYesDepends on connectorWorkflow automation

Change Data Capture (CDC)

What is CDC?

Change Data Capture records every data modification that occurs within selected database tables.

Unlike Change Tracking, CDC stores:

  • The type of operation
  • Before and after values (where applicable)
  • Transaction information
  • Log Sequence Numbers (LSNs)
  • Timestamps

CDC reads changes directly from the SQL Server transaction log instead of requiring application modifications.


How CDC Works

  1. User modifies data.
  2. SQL writes changes to the transaction log.
  3. CDC captures the changes.
  4. Changes are written into CDC system tables.
  5. Applications or ETL tools read the captured changes.
Application
SQL Table
Transaction Log
CDC Capture Process
CDC Change Tables
ETL / Azure Data Factory / Fabric

Information Stored by CDC

For every change, CDC stores:

  • Insert
  • Update
  • Delete
  • Transaction sequence
  • Changed columns
  • Original values
  • New values
  • Commit time
  • Log sequence number

This provides a complete history of modifications.


Advantages of CDC

Minimal application changes

Applications continue performing normal INSERT, UPDATE, and DELETE operations.


Incremental processing

Instead of processing millions of rows:

Yesterday:
10 million rows
Today:
Only 1,250 rows changed
CDC processes only 1,250 rows.

This dramatically improves ETL performance.


Supports Historical Analysis

CDC retains detailed change history.

Example:

Customer Name

Original:

John Smith

Updated:

John A. Smith

CDC preserves both versions.


Common CDC Use Cases

  • Azure Data Factory incremental loads
  • Microsoft Fabric ingestion
  • Data warehouse updates
  • Database replication
  • AI training pipelines
  • Audit solutions
  • Event publishing
  • Synchronizing microservices

Limitations

CDC:

  • Uses additional storage
  • Requires SQL Agent jobs (SQL Server)
  • Introduces some overhead
  • Retention must be managed
  • Generates additional transaction log activity

Change Tracking

What is Change Tracking?

Change Tracking is a lightweight feature that records which rows have changed, but does not store the actual changed values.

Instead, it stores metadata indicating:

  • Row changed
  • Row deleted
  • Version number

Applications retrieve the latest row directly from the table.


How Change Tracking Works

Instead of saving old values:

CustomerID 101 changed.

The application retrieves:

SELECT *
FROM Customers
WHERE CustomerID = 101

Only the current version is available.


Advantages

Very lightweight.

Minimal storage.

Minimal performance impact.

Simple synchronization.

Fast processing.


Limitations

Cannot determine:

Old value

New value

Only knows:

Row changed

No historical audit.

No before-and-after comparison.


Best Use Cases

Mobile synchronization

Offline applications

Client synchronization

Web applications

Caching

Incremental refresh

Applications only needing current data


CDC vs Change Tracking

FeatureCDCChange Tracking
Detect InsertsYesYes
Detect UpdatesYesYes
Detect DeletesYesYes
Stores Old ValuesYesNo
Stores New ValuesYesNo
Historical DataYesNo
Storage UsageHigherLower
ETL FriendlyExcellentLimited
SynchronizationGoodExcellent
AuditingExcellentPoor

Choosing Between CDC and Change Tracking

Choose CDC when:

  • Building ETL pipelines
  • Loading data warehouses
  • Creating audit systems
  • Tracking complete history
  • AI model retraining
  • Replication

Choose Change Tracking when:

  • Synchronizing mobile devices
  • Synchronizing applications
  • Detecting row changes only
  • Performance is critical
  • History is unnecessary

Change Event Streaming (CES)

What is Change Event Streaming?

Change Event Streaming is an event-driven approach that publishes database changes as events immediately after they occur.

Instead of applications polling for changes:

Did anything change?
Did anything change?
Did anything change?

The database immediately emits an event.


Event-Driven Architecture

INSERT Order
Database
Event Published
┌────┼────┐
▼ ▼ ▼
Function
Logic App
Service Bus

One database change can notify many downstream services simultaneously.


Advantages

Near real-time processing

Low latency

Highly scalable

Excellent for cloud-native applications

Supports asynchronous processing

Works well with event hubs and messaging systems


Common Scenarios

Order processing

Inventory updates

Recommendation engines

AI pipelines

Search indexing

Notifications

Microservices

IoT

Streaming analytics


Benefits over Polling

Polling example:

Check database every minute

Potential issues:

  • Delayed processing
  • Unnecessary database queries
  • Higher compute costs

Event streaming:

Change occurs
Immediate notification

Much more efficient.


Azure Functions with SQL Trigger Binding

Overview

Azure Functions provide a serverless compute platform capable of automatically executing code when database changes occur.

SQL Trigger Binding enables Azure Functions to react to SQL data modifications without requiring custom polling logic.

Typical workflow:

Database Change
SQL Trigger
Azure Function
Business Logic

Common Scenarios

Automatically:

  • Send emails
  • Generate invoices
  • Update search indexes
  • Invoke AI models
  • Call REST APIs
  • Update Cosmos DB
  • Write to Azure Storage
  • Publish Service Bus messages

Benefits

Serverless

Automatic scaling

Pay only for executions

Minimal infrastructure management

Easy integration with Azure services

Supports event-driven architectures


Example Scenario

A customer places an order.

INSERT Orders

The SQL trigger starts an Azure Function.

The function:

  • Validates inventory
  • Sends confirmation email
  • Updates recommendation engine
  • Notifies shipping
  • Publishes event

No manual polling required.


Azure Logic Apps

What Are Logic Apps?

Azure Logic Apps are low-code workflow automation services that integrate SQL databases with hundreds of Microsoft and third-party services.

Rather than writing custom code, workflows are built visually.

Example:

SQL Row Updated
Logic App
Teams Notification
Outlook Email
SharePoint Update
CRM Update

Common SQL Integrations

SQL Server

Azure SQL Database

Microsoft Dataverse

Dynamics 365

Salesforce

Microsoft Teams

SharePoint

Azure Storage

Azure Service Bus

Azure Event Grid

Power Automate


Typical Workflow

Customer Created
Logic App
Create CRM Record
Send Welcome Email
Create Help Desk Ticket
Notify Sales Team

Advantages

Low-code

Rapid development

Hundreds of connectors

Visual designer

Built-in retry policies

Error handling

Scheduling

Monitoring

Enterprise integration


Limitations

Logic Apps are ideal for orchestration and workflow automation but are not intended for high-throughput transactional processing where custom code or event streaming solutions may provide better scalability and lower latency.


Choosing the Right Technology

RequirementRecommended Solution
Incremental ETLCDC
Data Warehouse LoadingCDC
Audit HistoryCDC
Mobile SyncChange Tracking
Cache RefreshChange Tracking
Event-Driven ProcessingChange Event Streaming
Serverless Business LogicAzure Functions SQL Trigger
Workflow AutomationAzure Logic Apps
AI Pipeline TriggerAzure Functions or CES
Multi-System IntegrationLogic Apps

Best Practices

Enable Only What You Need

Enable CDC or Change Tracking only on tables that require change detection.


Monitor Storage

CDC tables can grow quickly.

Implement retention policies and cleanup jobs.


Prefer Event-Driven Architectures

Avoid continuous polling whenever possible.

Use:

  • CES
  • Azure Functions
  • Event Grid
  • Service Bus

for scalable cloud-native applications.


Separate Operational and Analytical Workloads

Use CDC to move transactional data into analytical platforms instead of querying production systems directly.


Secure Integration Endpoints

Protect Azure Functions and Logic Apps using:

  • Microsoft Entra ID
  • Managed identities
  • Azure Key Vault
  • Least privilege access
  • Network restrictions where appropriate

Monitor Reliability

Track:

  • Failed executions
  • Retry attempts
  • Dead-letter queues
  • Function failures
  • Logic App run history
  • Event delivery failures

DP-800 Exam Tips

Remember these common exam distinctions:

  • CDC records complete data changes, including inserted, updated, and deleted values, making it ideal for ETL, auditing, and replication.
  • Change Tracking records only that a row changed, making it a lightweight solution for synchronization scenarios.
  • Change Event Streaming supports near real-time, event-driven architectures by publishing change events to downstream consumers.
  • Azure Functions with SQL Trigger Binding are best when database changes should execute custom serverless code automatically.
  • Azure Logic Apps are the preferred choice for orchestrating business workflows and integrating SQL databases with Azure and third-party services through low-code connectors.
  • When selecting a technology, evaluate latency requirements, scalability, historical tracking needs, operational overhead, and integration requirements rather than choosing a single solution for every scenario.

Summary

Modern SQL applications extend well beyond traditional databases, serving as event sources for cloud-native architectures, AI pipelines, analytics platforms, and business workflows. Microsoft provides several complementary technologies to detect and process database changes, each optimized for different scenarios.

For the DP-800 exam, you should understand not only how these technologies work, but also when to choose one over another. CDC excels at incremental ETL and auditing, Change Tracking offers lightweight synchronization, Change Event Streaming enables real-time event-driven systems, Azure Functions execute custom business logic in response to changes, and Azure Logic Apps simplify workflow automation across enterprise services.

A solid understanding of these tools will help you design scalable, maintainable, and performant AI-enabled database solutions in Azure.


Practice Exam Questions


Question 1

A company loads data from an Azure SQL Database into a Microsoft Fabric warehouse every hour. The ETL process should retrieve only rows that have changed since the previous load, including the previous and new values of updated rows.

Which technology should you recommend?

A. Change Tracking

B. Change Data Capture (CDC)

C. Azure Logic Apps

D. Azure Functions with SQL Trigger Binding

Correct Answer: B

Explanation

CDC is specifically designed for incremental data movement scenarios. It captures inserts, updates, and deletes directly from the transaction log and stores detailed information about each change, including before and after values where applicable.

Why the other options are incorrect:

  • A: Change Tracking identifies changed rows but does not store previous values.
  • C: Logic Apps orchestrate workflows but do not capture database changes.
  • D: Azure Functions respond to events but are not intended to maintain historical change data for ETL.

Question 2

A mobile application periodically synchronizes customer records with an Azure SQL Database. The application only needs to know which rows have changed since the last synchronization and does not require historical values.

Which feature is most appropriate?

A. Change Event Streaming

B. Azure Functions SQL Trigger

C. Change Tracking

D. CDC

Correct Answer: C

Explanation

Change Tracking is optimized for synchronization scenarios. It records that rows have changed while minimizing storage and processing overhead.

Why the other options are incorrect:

  • A: CES is designed for event-driven architectures.
  • B: Azure Functions execute custom code rather than maintaining synchronization metadata.
  • D: CDC stores detailed change history, which is unnecessary here.

Question 3

An online retailer wants every new order inserted into the Orders table to immediately trigger inventory updates, shipping notifications, and fraud detection.

Which solution best supports this requirement?

A. Scheduled polling queries

B. Change Tracking

C. Change Event Streaming (CES)

D. Nightly ETL jobs

Correct Answer: C

Explanation

CES enables near real-time event publishing whenever database changes occur. Multiple downstream systems can subscribe to the same event without repeatedly querying the database.

Why the other options are incorrect:

  • A: Polling introduces unnecessary latency and database load.
  • B: Change Tracking is intended for synchronization rather than event processing.
  • D: Nightly ETL introduces unacceptable delays.

Question 4

A database update should automatically execute custom C# code that calls several REST APIs and writes audit information to Azure Storage.

Which Azure service should you recommend?

A. Azure Functions with SQL Trigger Binding

B. CDC

C. Change Tracking

D. SQL Agent Job

Correct Answer: A

Explanation

Azure Functions with SQL Trigger Binding automatically execute custom code when qualifying database changes occur, making them ideal for serverless business logic.

Why the other options are incorrect:

  • B: CDC records changes but does not execute code.
  • C: Change Tracking simply records row modifications.
  • D: SQL Agent jobs rely on scheduled execution rather than event-driven processing.

Question 5

Which statement correctly compares Change Tracking and Change Data Capture?

A. CDC captures complete change history while Change Tracking records only that rows changed.

B. Change Tracking captures previous values while CDC does not.

C. Both features store identical information.

D. CDC only tracks INSERT operations.

Correct Answer: A

Explanation

CDC stores detailed information about every change, including inserts, updates, deletes, timestamps, and transaction metadata. Change Tracking only identifies which rows have changed.

The remaining options are incorrect because they reverse the capabilities or incorrectly describe CDC.


Question 6

A business analyst wants to automate the following workflow without writing custom code:

  • Detect a new customer record.
  • Send an Outlook email.
  • Post a Microsoft Teams notification.
  • Update a SharePoint list.

Which solution is the best choice?

A. CDC

B. Azure Logic Apps

C. Change Tracking

D. SQL CLR

Correct Answer: B

Explanation

Azure Logic Apps provide low-code workflow automation with hundreds of built-in connectors, making them ideal for orchestrating business processes across Microsoft services.

Why the other options are incorrect:

  • A: CDC captures changes but does not automate workflows.
  • C: Change Tracking only records modified rows.
  • D: SQL CLR requires custom coding and is not intended for cloud workflow automation.

Question 7

A development team currently polls the database every minute to determine whether new records have been inserted.

What is the primary disadvantage of this design?

A. It reduces database normalization.

B. It prevents indexing.

C. It increases transaction isolation.

D. It generates unnecessary database workload and introduces latency.

Correct Answer: D

Explanation

Polling repeatedly queries the database even when no changes exist, increasing resource consumption while delaying event processing.

Event-driven solutions such as CES or Azure Functions eliminate this inefficiency.


Question 8

Which technology is most appropriate when an organization must maintain a complete historical record of all row changes for regulatory auditing?

A. Azure Logic Apps

B. Change Tracking

C. Change Data Capture

D. Azure Functions

Correct Answer: C

Explanation

CDC preserves detailed information about inserts, updates, deletes, transaction sequence numbers, and timestamps, making it ideal for compliance and auditing.

The other technologies either automate workflows or identify changes without preserving historical values.


Question 9

Which feature is specifically intended to minimize synchronization overhead by storing only metadata about changed rows?

A. Azure Functions SQL Trigger

B. Change Tracking

C. Change Event Streaming

D. Azure Event Grid

Correct Answer: B

Explanation

Change Tracking records lightweight metadata that indicates which rows have changed, allowing applications to retrieve only the latest row versions.

The other options serve different purposes:

  • Azure Functions execute code.
  • CES publishes events.
  • Event Grid distributes events but does not track database modifications.

Question 10

A solution architect is selecting a technology for an event-driven microservices architecture. Multiple independent services must react immediately whenever product inventory changes.

Which solution best satisfies this requirement?

A. Nightly ETL processing

B. Change Tracking

C. Database polling every five minutes

D. Change Event Streaming (CES)

Correct Answer: D

Explanation

CES is designed for event-driven systems where multiple subscribers consume database change events in near real time. It minimizes latency and reduces unnecessary database queries.

Why the other options are incorrect:

  • A: Nightly processing is far too slow.
  • B: Change Tracking is intended for synchronization rather than event broadcasting.
  • C: Polling introduces unnecessary workload and delays.

Exam Tips

For the DP-800 exam, remember these key distinctions:

  • Change Data Capture (CDC) is best for incremental ETL, auditing, replication, and historical change tracking.
  • Change Tracking is designed for lightweight synchronization when only the fact that a row changed is needed.
  • Change Event Streaming (CES) enables near real-time event-driven architectures by publishing database changes to downstream consumers.
  • Azure Functions with SQL Trigger Binding are ideal for executing custom serverless code in response to database changes.
  • Azure Logic Apps provide low-code workflow automation for integrating Azure SQL with Microsoft and third-party services.
  • On the exam, Microsoft often presents multiple technologies that could work. Choose the one that best aligns with the business requirement, considering factors such as latency, historical tracking, automation, scalability, and operational overhead, rather than selecting the most feature-rich option.

Go to the DP-800 Exam Prep Hub main page

Evaluate external models, including multimodal, multilanguage, sizes, and structured output (DP-800 Exam Prep)

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 models and embeddings
      --> Evaluate external models, including multimodal, multilanguage, sizes, and structured output


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 most important responsibilities of a SQL AI Developer is selecting the appropriate AI model for a given business problem. Microsoft SQL Server, Azure SQL Database, Azure SQL Managed Instance, and Azure AI services increasingly integrate with external Large Language Models (LLMs) and embedding models to provide intelligent capabilities such as natural language querying, document summarization, semantic search, recommendation engines, and Retrieval-Augmented Generation (RAG).

Not every model is suitable for every workload. Larger models generally provide better reasoning but incur higher costs and latency. Smaller models offer faster responses and lower costs but may lack advanced reasoning capabilities. Some models support images and audio (multimodal), while others specialize in text or code. Additionally, many enterprise applications require structured outputs such as JSON rather than free-form text.

For the DP-800 exam, candidates should understand how to evaluate external models based on business requirements, performance, cost, scalability, and AI capabilities.


What Are External Models?

An external model is an AI model that runs outside the database engine and is accessed through an API or AI service.

Examples include:

  • Azure OpenAI models
  • Azure AI Foundry-hosted models
  • Open-source models hosted on Azure AI Foundry or Kubernetes
  • Other cloud-hosted foundation models exposed through REST APIs

Instead of performing AI inference inside SQL Server, the application or database calls an external service.

Example architecture:

Application
Azure SQL Database
Azure OpenAI Service
AI Model
Generated Response

This approach allows SQL-based applications to leverage continuously improving AI models without modifying the database engine.


Factors When Evaluating External Models

Several characteristics should be considered before selecting a model.

These include:

  • Accuracy
  • Reasoning capability
  • Response quality
  • Cost
  • Latency
  • Throughput
  • Context window size
  • Structured output support
  • Multilingual capability
  • Multimodal capability
  • Security and compliance
  • Availability
  • Scalability

Selecting the right model is often a balance between these factors rather than maximizing any single characteristic.


Evaluating Multimodal Models

What Is a Multimodal Model?

A multimodal model can process multiple types of input rather than only text.

Common input types include:

  • Text
  • Images
  • Documents
  • Charts
  • Audio
  • Video (supported by some models)

Example:

A customer uploads:

  • Invoice PDF
  • Photograph of damaged goods
  • Written description

A multimodal model can analyze all three inputs together.


Business Scenarios

Multimodal models are useful for:

  • Document analysis
  • Invoice processing
  • Insurance claims
  • Medical imaging
  • Manufacturing quality inspections
  • Product recognition
  • OCR-enhanced workflows
  • Diagram interpretation

Example:

Instead of asking:

“Describe this invoice.”

The application uploads the invoice itself.

The model extracts:

  • Vendor
  • Invoice number
  • Total
  • Purchase date
  • Line items

Advantages

Multimodal models:

  • Reduce preprocessing
  • Improve accuracy
  • Handle real-world data
  • Simplify AI workflows
  • Support richer user experiences

Limitations

They typically:

  • Cost more
  • Require more compute resources
  • Have higher latency
  • Process larger payloads
  • May not be necessary for text-only applications

Evaluating Multilingual Models

Many enterprise applications serve users around the world.

A multilingual model understands and generates responses in multiple languages without requiring translation.

Example languages include:

  • English
  • Spanish
  • French
  • German
  • Portuguese
  • Japanese
  • Chinese
  • Korean
  • Arabic

Example

Customer question:

Spanish:

¿Cuál es el estado de mi pedido?

The AI responds correctly in Spanish.


Business Benefits

Multilingual models:

  • Improve customer experience
  • Eliminate translation pipelines
  • Simplify global deployments
  • Maintain conversational context across languages
  • Reduce development complexity

Evaluation Criteria

When comparing multilingual models, evaluate:

  • Number of supported languages
  • Translation quality
  • Cultural understanding
  • Domain-specific terminology
  • Consistency across languages
  • Response quality

Common Use Cases

  • Global customer support
  • International e-commerce
  • Government services
  • Travel applications
  • Healthcare portals
  • Financial institutions

Evaluating Model Size

Model size generally refers to the relative complexity and capability of an AI model. While parameter counts are not always publicly disclosed for commercial models, larger models typically provide stronger reasoning at the cost of increased compute requirements.

Generally:

Small model

  • Faster
  • Lower cost
  • Lower latency

Large model

  • Better reasoning
  • Better code generation
  • Better summarization
  • Higher cost
  • Higher latency

Small Models

Ideal for:

  • Chatbots
  • Classification
  • Data extraction
  • Intent detection
  • Basic summarization

Advantages:

  • Fast responses
  • Low operational cost
  • High throughput
  • Efficient scaling

Medium Models

Good balance between:

  • Performance
  • Cost
  • Accuracy

Typical uses:

  • Customer support
  • SQL generation
  • Business assistants
  • Document summarization

Large Models

Best for:

  • Complex reasoning
  • Long documents
  • Advanced coding
  • RAG
  • Planning
  • Agentic AI

Trade-offs include:

  • Higher inference costs
  • Greater latency
  • Increased resource consumption

Latency vs. Accuracy

Every AI solution involves balancing response speed and output quality.

Example:

Customer chatbot

Acceptable latency:

2–3 seconds

Scientific research assistant

Acceptable latency:

10–20 seconds

because answer quality matters more than speed.


Trade-Off Example

RequirementPreferred Model
Fast API responsesSmaller model
High-quality reasoningLarger model
Thousands of concurrent usersSmaller or medium model
Legal document analysisLarger model
AI coding assistantLarger model
FAQ chatbotSmaller model

Context Window Size

The context window defines how much information the model can process in a single request.

A larger context window allows the model to consider more text simultaneously.

Examples include:

  • Long contracts
  • Large knowledge bases
  • Entire manuals
  • Meeting transcripts
  • Large SQL schemas

Benefits

Larger context windows reduce the need to split documents into smaller chunks and help preserve context across lengthy inputs.


Limitations

Larger contexts generally:

  • Increase processing time
  • Increase inference cost
  • Consume more tokens

Applications should include only relevant information rather than maximizing context size unnecessarily.


Structured Output

Many enterprise applications require machine-readable responses instead of conversational text.

Example:

Instead of:

“The customer’s order total is $425 and ships tomorrow.”

Return:

{
"customer":"John Smith",
"orderTotal":425,
"shipDate":"2026-07-29"
}

Structured output allows applications to parse responses reliably.


Why Structured Output Matters

Applications can:

  • Deserialize JSON
  • Populate SQL tables
  • Call stored procedures
  • Trigger workflows
  • Validate data
  • Build dashboards

without performing fragile text parsing.


Common Structured Formats

  • JSON
  • JSON arrays
  • Objects
  • Lists
  • Tables
  • XML (less common)
  • Markdown tables (for presentation)

JSON remains the most common structured format for modern AI integrations.


Function Calling and Tool Use

Many modern models support function calling (also called tool calling), where the model requests that the application invoke predefined functions or APIs instead of generating all information directly.

Example workflow:

User
LLM
Calls:
GetCustomerOrders()
Application
SQL Database
Results
LLM
Final Answer

This approach improves accuracy by combining model reasoning with authoritative business data.


Cost Considerations

AI model selection has a direct impact on operational cost.

Factors affecting cost include:

  • Model complexity
  • Input tokens
  • Output tokens
  • Images processed
  • Audio processed
  • Request volume
  • Concurrency
  • Context window size

A higher-capability model should only be selected when its additional reasoning or multimodal features provide measurable business value.


Benchmarking Models

Before deploying an external model into production, evaluate it against representative workloads.

Typical metrics include:

  • Response accuracy
  • Hallucination rate
  • Latency
  • Cost per request
  • Throughput
  • Reliability
  • Structured output validity
  • Multilingual quality
  • Safety and policy compliance

Use realistic prompts and datasets that reflect production scenarios.


Security and Responsible AI

When integrating external models with SQL-based applications:

  • Protect sensitive data.
  • Apply the principle of least privilege.
  • Use managed identities where possible.
  • Store secrets securely (for example, in Azure Key Vault).
  • Validate AI-generated outputs before acting on them.
  • Avoid sending unnecessary personally identifiable information (PII) to external services.
  • Monitor prompts and responses for safety, quality, and compliance.

Azure OpenAI Model Selection Guidance

Although Microsoft’s available models evolve over time, the evaluation process remains consistent.

When choosing a model, consider:

  • Does the workload require multimodal input?
  • Is multilingual support necessary?
  • What response latency is acceptable?
  • How much reasoning capability is required?
  • Is structured JSON output needed?
  • Will the model participate in a RAG workflow?
  • What are the expected request volumes?
  • What is the available budget?

The best model is the one that satisfies the business requirements while meeting performance, cost, and governance objectives.


Best Practices

  • Match model capability to business requirements.
  • Avoid selecting the largest model unless its advanced capabilities are needed.
  • Use structured outputs whenever applications consume AI responses programmatically.
  • Benchmark multiple models using representative production scenarios.
  • Minimize token usage to reduce costs and improve response times.
  • Use multimodal models only when image, audio, or document understanding is required.
  • Validate generated content before updating databases or executing business processes.
  • Monitor quality, latency, and cost continuously after deployment.

DP-800 Exam Tips

Remember these key distinctions for the exam:

  • Multimodal models process multiple input types, such as text and images.
  • Multilingual models understand and generate content in multiple languages without requiring separate translation services.
  • Smaller models typically provide lower latency and lower cost, making them suitable for high-volume, straightforward tasks.
  • Larger models generally provide stronger reasoning, summarization, and code generation but require more compute resources and incur higher costs.
  • Structured outputs, particularly JSON, are preferred when AI responses must be consumed by applications, APIs, or SQL processes.
  • Function calling allows models to invoke trusted business logic or database operations instead of relying solely on generated responses.
  • Model selection should always balance accuracy, latency, scalability, cost, security, and maintainability.

Summary

Selecting an external AI model is one of the most important architectural decisions in AI-enabled database solutions. The ideal model depends on the workload, whether that involves multilingual customer support, multimodal document analysis, structured data extraction, or advanced reasoning over enterprise data.

For the DP-800 exam, focus on understanding the trade-offs among model capabilities rather than memorizing specific model names. Be prepared to evaluate models based on multimodal support, multilingual performance, reasoning quality, latency, cost, context window size, and structured output capabilities. Equally important is understanding how these models integrate with Azure SQL and Azure AI services to build scalable, secure, and maintainable AI-enabled database solutions.


Practice Exam Questions


Question 1

You are developing an AI-enabled application that summarizes support tickets stored in Azure SQL Database. The application must support English, Spanish, French, German, and Japanese without deploying separate models for each language.

Which type of model best satisfies this requirement?

A. A monolingual English language model with prompt translation
B. A multilingual language model trained on multiple languages
C. A computer vision model with OCR capabilities
D. A speech recognition model

Correct Answer: B

Explanation:
Multilingual large language models (LLMs) are specifically trained to understand and generate text in many languages, eliminating the need to deploy separate models for each supported language. While prompt translation can work, it introduces additional latency and possible translation inaccuracies. Computer vision and speech models are not designed for multilingual text generation.


Question 2

An organization wants an AI model that can analyze scanned invoices, extract tables, understand handwritten notes, and answer user questions about the document.

Which model capability is required?

A. Structured output only
B. Text embedding generation
C. Multimodal processing
D. Sentiment analysis

Correct Answer: C

Explanation:
Multimodal models process multiple input types—including images, documents, handwritten text, and natural language—allowing them to interpret invoices and answer questions. Embedding models create vector representations but do not analyze images directly.


Question 3

You need an AI model that consistently returns data in valid JSON matching a predefined schema for direct insertion into a SQL table.

Which capability should you prioritize?

A. Long context window
B. Large parameter count
C. Function calling only
D. Structured output support

Correct Answer: D

Explanation:
Structured output capabilities ensure responses conform to predefined schemas such as JSON, reducing parsing errors and simplifying database integration. Function calling invokes external operations but does not guarantee JSON schema compliance.


Question 4

Your application performs simple product categorization and sentiment analysis on thousands of customer reviews every minute. Response time and operational cost are more important than handling complex reasoning tasks.

Which model size is the most appropriate?

A. The largest available reasoning model
B. A medium-sized multimodal model
C. A small language model optimized for classification tasks
D. A vision-language model

Correct Answer: C

Explanation:
Simple classification workloads generally do not require large reasoning models. Smaller models provide lower latency, reduced infrastructure costs, and sufficient accuracy for routine categorization and sentiment analysis.


Question 5

A financial institution evaluates several external AI models before deployment.

Which factor should receive the highest priority when handling confidential customer information?

A. Number of supported programming languages
B. Data privacy and regulatory compliance
C. Maximum context window size
D. Availability of image generation

Correct Answer: B

Explanation:
For regulated industries, protecting sensitive information and complying with regulations are primary evaluation criteria. Features such as image generation or larger context windows are secondary if the model cannot satisfy organizational security and compliance requirements.


Question 6

Your organization must choose between two external language models.

Model A produces slightly more accurate answers but averages 8 seconds per response.

Model B is slightly less accurate but consistently responds in under one second.

Which consideration is being evaluated?

A. Tokenization strategy
B. Embedding dimensions
C. Latency versus accuracy tradeoff
D. Database normalization

Correct Answer: C

Explanation:
Model evaluation frequently involves balancing response quality against latency. Interactive applications often prioritize faster responses, while analytical workloads may tolerate longer processing times for greater accuracy.


Question 7

A development team is comparing two embedding models.

One produces 768-dimensional vectors while another produces 3,072-dimensional vectors.

What is generally true?

A. Higher-dimensional embeddings always guarantee better search results.
B. Larger embeddings often improve semantic representation but require more storage and computation.
C. Embedding dimensions have no effect on vector databases.
D. Smaller embeddings always produce higher recall.

Correct Answer: B

Explanation:
Higher-dimensional vectors can capture richer semantic information but increase storage requirements, indexing costs, and similarity search computation. Larger dimensions do not automatically produce better search quality.


Question 8

A healthcare application requires AI-generated discharge summaries that follow a strict template so they can be automatically imported into Azure SQL Database.

Which model feature is most important?

A. Image generation capabilities
B. Speech synthesis support
C. Larger token limits only
D. Structured output generation

Correct Answer: D

Explanation:
Structured outputs enable AI-generated responses to consistently match required formats, such as JSON or predefined schemas, simplifying automated ingestion into databases and reducing validation errors.


Question 9

Why might an organization intentionally choose a smaller external language model instead of the newest, largest model?

A. Smaller models are always more accurate.
B. Smaller models always support more languages.
C. Smaller models often provide lower cost, reduced latency, and sufficient performance for many workloads.
D. Smaller models eliminate the need for prompt engineering.

Correct Answer: C

Explanation:
Many enterprise workloads involve straightforward tasks where the largest model offers minimal additional benefit. Smaller models frequently provide faster responses, lower inference costs, and simpler deployment while meeting performance requirements.


Question 10

An AI-enabled SQL application must process both text and uploaded product images to answer customer questions.

Which model should be recommended?

A. A multimodal language model
B. A text embedding model only
C. A relational database engine
D. A recommendation engine

Correct Answer: A

Explanation:
Multimodal models can simultaneously process textual and visual information, enabling users to ask questions about images and receive context-aware responses. Text embedding models only generate vector representations and cannot directly analyze images.


Exam Tips

For the DP-800 exam, remember these key evaluation principles when selecting external AI models:

  • Select multilingual models when supporting multiple languages without translation pipelines.
  • Choose multimodal models whenever applications must process images, documents, audio, or mixed media.
  • Prefer structured output capabilities when AI responses must populate SQL tables or APIs reliably.
  • Evaluate model size based on workload complexity, balancing cost, latency, throughput, and reasoning ability.
  • Consider privacy, compliance, and data residency before selecting external AI services.
  • Compare models using multiple metrics, including accuracy, latency, throughput, token limits, context window size, scalability, and operational cost.
  • Remember that larger models are not always the best choice—the optimal model is the one that best satisfies the application’s functional, performance, security, and budget requirements.

Go to the DP-800 Exam Prep Hub main page

Create and manage external models (DP-800 Exam Prep)

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 models and embeddings
      --> Create and manage external models


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 major additions to Microsoft SQL Server 2025, Azure SQL Database, and Azure SQL Managed Instance is the ability to directly integrate with external Artificial Intelligence (AI) models. Rather than exporting data to a separate application, developers can invoke Large Language Models (LLMs), embedding models, or other AI services directly from SQL code. This significantly simplifies the development of intelligent database applications.

For the DP-800 exam, candidates should understand how external models are configured, managed, secured, monitored, and consumed from SQL databases. They should also understand the architectural considerations involved in connecting SQL Server to external AI services such as Azure OpenAI Service, Azure AI Foundry models, GitHub Models, or other OpenAI-compatible endpoints.


What Are External Models?

An external model is an AI model that is hosted outside the SQL database but can be invoked securely from SQL statements.

Instead of training or hosting the model inside SQL Server, SQL sends requests to the model through a configured endpoint.

Examples include:

  • Azure OpenAI GPT models
  • Azure AI Foundry models
  • OpenAI API models
  • GitHub Models
  • Cohere models
  • Meta Llama models
  • Mistral AI models
  • Other OpenAI-compatible endpoints

The SQL database becomes an intelligent application layer capable of performing AI operations while leaving model hosting and scaling to specialized AI services.


Why Use External Models?

External AI models provide capabilities such as:

  • Natural language generation
  • Text summarization
  • Classification
  • Translation
  • Sentiment analysis
  • Content generation
  • Question answering
  • Embedding generation
  • Semantic search
  • Retrieval-Augmented Generation (RAG)

Without external models, these tasks would require exporting database data into an application layer before AI processing.


Benefits of External Models

Using external models provides several advantages:

Reduced Application Complexity

Applications can invoke AI directly from SQL instead of implementing additional middleware.

Centralized Data Processing

Data remains closer to where it is stored, reducing unnecessary movement.

Simplified Development

Developers write SQL instead of building custom AI integration layers.

Enterprise Security

Authentication occurs through secure credentials and managed identities.

Scalability

The external AI provider handles model hosting, GPU infrastructure, scaling, and updates.


External Model Architecture

A typical architecture consists of:

Application
Azure SQL Database
External Model Definition
Credential
HTTPS Endpoint
Azure OpenAI / AI Foundry / OpenAI

SQL sends HTTPS requests to the configured endpoint and returns the model’s response to the calling application.


Components of an External Model

An external model configuration typically includes:

  • Model name
  • Endpoint URL
  • Authentication method
  • API version
  • Deployment name
  • Credentials
  • Optional timeout settings
  • Model capabilities

Supported AI Services

DP-800 focuses primarily on Microsoft’s AI ecosystem.

Common supported services include:

Azure OpenAI Service

Most common deployment option.

Supports:

  • GPT-4
  • GPT-4.1
  • GPT-4o
  • GPT-4 Turbo
  • Embedding models

Azure AI Foundry

Provides access to multiple foundation models from various providers.

Examples include:

  • Meta Llama
  • Mistral
  • Cohere
  • Phi models
  • DeepSeek (where available)

OpenAI-Compatible APIs

SQL can communicate with services implementing the OpenAI API specification.


Creating an External Model

The general process includes:

Step 1

Deploy a model in Azure AI Foundry or Azure OpenAI.


Step 2

Create authentication credentials.

Examples include:

  • API Keys
  • Microsoft Entra ID authentication
  • Managed Identity

Step 3

Create an external model definition inside SQL.

This associates:

  • endpoint
  • deployment
  • credentials
  • model metadata

Step 4

Test connectivity.

Execute SQL queries that invoke the model.


Step 5

Monitor usage.

Review:

  • failures
  • latency
  • token consumption
  • throttling

Authentication Methods

Security is a major exam topic.

Supported authentication methods include:

API Keys

Simple to configure.

Advantages:

  • Easy setup

Disadvantages:

  • Requires secure storage
  • Must be rotated regularly

Microsoft Entra ID

Recommended for enterprise deployments.

Benefits:

  • Central identity management
  • Conditional Access
  • Role-Based Access Control
  • No hardcoded secrets

Managed Identity

Preferred when SQL services interact with Azure services.

Advantages:

  • No passwords
  • Automatic credential rotation
  • Strong security posture

Managing Credentials

Credentials should never be hardcoded into SQL scripts.

Best practices include:

  • Azure Key Vault
  • Managed Identity
  • Secure credential objects
  • Secret rotation
  • Least privilege

Model Configuration Considerations

When selecting a model, evaluate:

  • Latency
  • Cost
  • Context window
  • Maximum tokens
  • Supported languages
  • Multimodal support
  • Structured outputs
  • Function calling
  • Embedding support
  • Regional availability

Model Version Management

AI models evolve frequently.

Developers should:

  • Test new versions
  • Validate prompt compatibility
  • Measure output quality
  • Compare latency
  • Evaluate token costs
  • Deploy gradually

Avoid automatically replacing production models without validation.


Monitoring External Models

Important operational metrics include:

  • Request count
  • Failed requests
  • Average latency
  • Token usage
  • Cost
  • Timeout frequency
  • Authentication failures
  • Rate limiting
  • Model availability

Monitoring may be performed using Azure Monitor, Azure OpenAI metrics, Application Insights, and Log Analytics.


Error Handling

Applications should anticipate failures such as:

  • Network interruptions
  • Authentication failures
  • Invalid prompts
  • Model timeouts
  • Rate limiting
  • Endpoint unavailability
  • Quota exhaustion

Applications should implement:

  • Retry logic
  • Exponential backoff
  • Logging
  • Graceful degradation
  • User-friendly error messages

Cost Management

External AI services typically charge based on token usage.

Cost optimization strategies include:

  • Select smaller models when appropriate.
  • Minimize unnecessary prompts.
  • Cache reusable responses.
  • Use embeddings instead of repeated generation where applicable.
  • Monitor token consumption.
  • Apply rate limits where appropriate.

Security Best Practices

Microsoft recommends:

  • Use Microsoft Entra ID whenever possible.
  • Store secrets securely.
  • Rotate API keys regularly.
  • Restrict network access.
  • Enable auditing.
  • Monitor authentication failures.
  • Apply least privilege.
  • Encrypt data in transit.
  • Avoid sending sensitive information unnecessarily.

Best Practices for DP-800

Candidates should remember the following:

  • External models are hosted outside SQL.
  • SQL communicates with models over secure HTTPS endpoints.
  • Azure OpenAI and Azure AI Foundry are primary Microsoft AI services.
  • Managed Identity is generally preferred over API keys in Azure.
  • Never hardcode secrets.
  • Monitor token usage and latency.
  • Plan for retries and transient failures.
  • Validate model updates before production deployment.
  • Balance performance, cost, and model capabilities.
  • Use the smallest model that satisfies business requirements.

DP-800 Exam Tips

For the exam, be prepared to:

  • Differentiate between external models and local database objects.
  • Understand authentication methods.
  • Identify secure credential storage mechanisms.
  • Select appropriate model types.
  • Monitor AI usage and performance.
  • Recommend enterprise security practices.
  • Manage model lifecycle and versioning.
  • Understand cost optimization strategies.
  • Configure reliable AI integrations.
  • Recognize scenarios where Azure OpenAI or Azure AI Foundry is the preferred solution.

Key Takeaways

Creating and managing external models enables SQL databases to leverage modern AI capabilities without hosting AI infrastructure locally. By securely connecting SQL Server or Azure SQL to services like Azure OpenAI or Azure AI Foundry, developers can incorporate intelligent features such as summarization, classification, semantic search, and RAG directly into database applications. Success depends on proper authentication, secure credential management, monitoring, version control, cost optimization, and selecting the right model for each workload.


Practice Exam Questions

Question 1

A developer wants to enable an Azure SQL Database application to generate natural language summaries using GPT-4o hosted in Azure OpenAI. What is the primary purpose of creating an external model?

A. To copy the AI model into SQL Server memory

B. To allow SQL to securely invoke an externally hosted AI model

C. To convert SQL queries into Python scripts

D. To replace stored procedures with AI-generated code

Correct Answer: B

Explanation: External models define the connection between SQL and an externally hosted AI service. The model remains hosted in Azure OpenAI or another provider, while SQL securely sends requests to it.


Question 2

Which authentication method is generally recommended for Azure SQL Database accessing Azure OpenAI in an enterprise environment?

A. Username and password authentication

B. Shared administrator account

C. Managed Identity

D. Anonymous authentication

Correct Answer: C

Explanation: Managed Identity eliminates the need to store secrets, supports automatic credential rotation, and integrates with Microsoft Entra ID, making it Microsoft’s recommended authentication approach for Azure resources.


Question 3

An organization wants to minimize operational overhead while securely accessing external AI models. Which authentication mechanism best satisfies this requirement?

A. API keys stored in application code

B. SQL logins

C. Managed Identity

D. Local Windows accounts

Correct Answer: C

Explanation: Managed Identity removes the need to manually manage secrets and provides secure, automatic authentication between Azure services.


Question 4

Which factor should be monitored most closely to help control the operational cost of external language models?

A. Token consumption

B. Number of database indexes

C. Memory allocated to SQL Server

D. CPU utilization on the SQL Server

Correct Answer: A

Explanation: Most external LLM providers charge based on token usage. Monitoring prompt and completion tokens helps organizations estimate and manage AI costs.


Question 5

A developer needs to securely store API credentials used by an external model.

Which solution follows Microsoft security best practices?

A. Store the API key in Azure Key Vault

B. Save the API key in a table within the application database

C. Embed the API key in application source code

D. Place the API key in a configuration file committed to source control

Correct Answer: A

Explanation: Azure Key Vault provides secure storage, access policies, auditing, and secret rotation capabilities, making it the recommended location for sensitive credentials.


Question 6

Why should organizations validate new versions of external AI models before deploying them into production?

A. New versions always increase latency.

B. New versions cannot process SQL data.

C. Model behavior, output quality, and performance characteristics may change.

D. SQL Server requires a database restart after every model update.

Correct Answer: C

Explanation: AI model updates can alter response quality, reasoning, formatting, latency, and cost. Testing ensures compatibility with existing applications and prompts.


Question 7

Which capability is provided by Azure AI Foundry that benefits SQL developers?

A. It hosts only Microsoft-developed language models.

B. It provides access to multiple foundation models from different providers.

C. It automatically creates SQL indexes.

D. It replaces Azure SQL Database.

Correct Answer: B

Explanation: Azure AI Foundry offers access to numerous foundation models from Microsoft and third-party providers, enabling developers to select the most appropriate model for their workloads.


Question 8

An external model begins returning timeout errors during peak business hours.

Which application design strategy should be implemented?

A. Disable authentication.

B. Delete and recreate the database.

C. Increase the number of SQL indexes.

D. Implement retry logic with exponential backoff.

Correct Answer: D

Explanation: Transient failures, including timeouts, are common in distributed systems. Retry logic with exponential backoff improves resilience without overwhelming the external service.


Question 9

Which statement best describes an external AI model?

A. It is stored entirely within the SQL database.

B. It executes as a SQL stored procedure.

C. It is hosted externally and accessed through a secure endpoint.

D. It permanently replaces relational queries.

Correct Answer: C

Explanation: External AI models remain hosted outside the database. SQL communicates with them using secure HTTPS requests through configured endpoints.


Question 10

When selecting between multiple external AI models, which combination of evaluation criteria is most appropriate?

A. Number of SQL tables and indexes

B. Latency, cost, capabilities, context window, security, and accuracy

C. File system capacity only

D. Number of database users

Correct Answer: B

Explanation: Choosing the right external model requires balancing functional capabilities with operational considerations such as latency, cost, accuracy, security, supported features, and context window size.


Go to the DP-800 Exam Prep Hub main page

Choose an embedding maintenance method, including table triggers, Change Tracking, Azure Functions with SQL trigger binding, Azure Logic Apps, CDC, CES, and Microsoft Foundry – Part 1 (DP-800 Exam Prep)

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 models and embeddings
      --> Choose an embedding maintenance method, including table triggers, Change Tracking, Azure Functions with SQL trigger binding, Azure Logic Apps, CDC, CES, and Microsoft Foundry


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 most important aspects of building AI-enabled database applications is maintaining the accuracy of vector embeddings. Embeddings represent the semantic meaning of data at a specific point in time. Whenever the underlying source data changes, the associated embeddings may become outdated. If stale embeddings remain in a vector index, semantic search, Retrieval-Augmented Generation (RAG), recommendation engines, and AI assistants can produce inaccurate or misleading results.

For the DP-800 exam, candidates should understand the various methods available to detect changes to relational data and automatically regenerate embeddings. Microsoft SQL Server 2025 and Azure SQL provide several mechanisms to detect data changes, each with different tradeoffs in performance, scalability, complexity, and latency.

The exam focuses on selecting the most appropriate embedding maintenance strategy based on business requirements.


What Is Embedding Maintenance?

Embedding maintenance is the process of keeping vector embeddings synchronized with the underlying relational data.

Whenever data changes, one or more of the following actions may be required:

  • Generate a new embedding.
  • Replace the old embedding.
  • Update the vector index.
  • Remove deleted vectors.
  • Refresh search indexes.

Without proper maintenance, semantic search quality gradually degrades.


Why Embedding Maintenance Is Important

Suppose a product catalog contains this description:

“Wireless Bluetooth Noise-Cancelling Headphones”

An embedding is generated from that description.

Later, the product description changes to:

“Wireless Bluetooth Noise-Cancelling Headphones with Spatial Audio and USB-C Fast Charging”

If the embedding is not regenerated:

  • AI searches may not return the product.
  • Vector similarity decreases.
  • RAG answers become outdated.
  • Recommendation quality drops.

Keeping embeddings synchronized ensures AI applications remain accurate.


Common Embedding Maintenance Workflow

Most embedding maintenance solutions follow this lifecycle:

User Updates SQL Data
Change Detection
Generate New Embedding
Store Updated Vector
Refresh Vector Search Index

The primary difference between maintenance methods is how they detect changes.


Choosing the Right Maintenance Strategy

Microsoft provides several approaches:

MethodTypical LatencyComplexityBest For
Table TriggersImmediateLowSmall databases
Change TrackingLowMediumIncremental synchronization
Change Data Capture (CDC)MediumMediumETL and analytics
Azure Functions SQL TriggerNear real-timeMediumEvent-driven cloud apps
Azure Logic AppsNear real-timeLowLow-code automation
Change Event Streaming (CES)Real-timeHighStreaming architectures
Microsoft Foundry PipelinesScheduled or event-drivenMediumAI data pipelines

Table Triggers

What Are They?

Table triggers automatically execute SQL code whenever data changes.

Example events include:

  • INSERT
  • UPDATE
  • DELETE

Triggers provide immediate notification that data has changed.


Embedding Workflow Using Triggers

UPDATE Product
Trigger Executes
Identify Changed Row
Queue Embedding Job

The trigger usually should not generate the embedding itself because AI model inference may take several seconds.

Instead, the trigger inserts a work item into a processing queue.


Advantages

  • Immediate detection
  • Simple implementation
  • Works entirely within SQL
  • No polling required

Disadvantages

  • Can increase transaction duration
  • Poor choice for expensive AI operations
  • May reduce OLTP performance
  • Difficult to scale for very high transaction volumes

Best Practice

Use triggers only to record changes—not to call AI models directly.


Change Tracking

What Is Change Tracking?

Change Tracking is a lightweight SQL Server feature that records which rows have changed without recording every individual data modification.

Applications periodically retrieve changed rows and regenerate only affected embeddings.


Workflow

Application
Read Change Tracking
Changed Rows
Generate Embeddings
Update Vector Table

Advantages

  • Lightweight
  • Low storage overhead
  • Incremental processing
  • Excellent for synchronization

Limitations

  • Does not capture previous values
  • Does not store complete history
  • Requires periodic polling

Best Use Cases

  • RAG applications
  • Semantic search
  • Incremental embedding refresh
  • Azure SQL synchronization

Change Data Capture (CDC)

What Is CDC?

Change Data Capture records detailed information about every change made to a table.

It captures:

  • Inserts
  • Updates
  • Deletes
  • Previous values
  • New values
  • Log sequence numbers (LSNs)

CDC reads the SQL transaction log rather than relying on triggers.


Workflow

Transaction Log
CDC Tables
Embedding Pipeline
Vector Updates

Advantages

  • Complete history
  • High reliability
  • Efficient large-scale processing
  • Ideal for ETL

Disadvantages

  • More storage than Change Tracking
  • Higher administrative overhead
  • Not truly instantaneous

Best Use Cases

  • Enterprise ETL
  • Large databases
  • Historical auditing
  • Batch embedding refresh

Comparing Change Tracking and CDC

FeatureChange TrackingCDC
Tracks changed rowsYesYes
Stores previous valuesNoYes
Transaction log basedNoYes
Full historyNoYes
Storage overheadLowMedium
SynchronizationExcellentExcellent
AuditingLimitedExcellent

Azure Functions with SQL Trigger Binding

Azure Functions provide serverless compute that automatically executes code when SQL data changes.

Instead of polling SQL continuously, the SQL trigger binding reacts to data modifications.

Typical workflow:

SQL Change
Azure Function
Generate Embedding
Store Vector

Advantages

  • Serverless
  • Automatic scaling
  • Pay-per-execution
  • Near real-time processing
  • Excellent Azure integration

Best Use Cases

  • Cloud-native AI applications
  • Azure SQL Database
  • RAG systems
  • Intelligent search solutions

Azure Logic Apps

Azure Logic Apps provide a low-code workflow engine.

Instead of writing custom code, developers configure workflows visually.

Typical workflow:

SQL Change
Logic App Trigger
Call Azure OpenAI
Update Embedding Table

Advantages

  • Low-code development
  • Hundreds of built-in connectors
  • Easy integration with Azure services
  • Fast implementation

Limitations

  • Less flexible than custom code
  • Higher latency than Azure Functions
  • Complex workflows can become difficult to maintain

Best Use Cases

  • Business automation
  • Small AI workflows
  • Rapid prototyping
  • Citizen developers

Choosing Between Triggers, Change Tracking, CDC, Azure Functions, and Logic Apps

ScenarioRecommended Method
Small OLTP databaseTable Trigger + Queue
Incremental synchronizationChange Tracking
Historical auditingCDC
Serverless AI processingAzure Functions
Low-code workflowAzure Logic Apps

DP-800 Exam Tips (Part 1)

Remember these key points for the exam:

  • Triggers provide immediate notification but should not directly perform expensive AI inference.
  • Change Tracking records which rows changed and is optimized for lightweight synchronization.
  • CDC captures detailed change history and is ideal for enterprise ETL and auditing.
  • Azure Functions with SQL trigger binding enable scalable, serverless, event-driven embedding generation.
  • Azure Logic Apps offer a low-code approach for automating embedding workflows with Azure services.
  • Select the maintenance method based on the required balance of latency, scalability, operational complexity, and business requirements.

Go to the DP-800 Exam Prep Hub main page