Question 16
Case Study - This is a case study. Case studies are not timed separately. You can use as much exam time as you would like to complete each case. However, there may be additional case studies and sections on this exam. You must manage your time to ensure that you are able to complete all questions included on this exam in the time provided. To answer the questions included in a case study, you will need to reference information that is provided in the case study. Case studies might contain exhibits and other resources that provide more information about the scenario that is described in the case study. Each question is independent of the other questions in this case study. At the end of this case study, a review screen will appear. This screen allows you to review your answers and to make changes before you move to the next section of the exam. After you begin a new section, you cannot return to this section. To start the case study - To display the first question in this case study, click the Next button. Use the buttons in the left pane to explore the content of the case study before you answer the questions. Clicking these buttons displays information such as business requirements, existing environment and problem statements. If the case study has an All Information tab, note that the information displayed is identical to the information displayed on the subsequent tabs. When you are ready to answer a question, click the Question button to return to the question. Existing Environment - Azure Environment - Fabrikam has a single Azure subscription in the East US 2 Azure region. The subscription contains an Azure SQL database named DB1. DB1 contains the following tables: • Patients • Employees • Procedures • Transactions • UsefulPrompts • ProcedureDocuments You store a column master key as a secret in Azure Key Vault. You have an on-premises application named TransactionProcessing that uses a hard-coded username and password in a connection string to access DB1. Problem Statements - Users report that after executing a long-running stored procedure named sp_UpdateProcedureForPatient, updates to the underlying data are sometimes inconsistent. Requirements - Planned Changes - Fabrikam plans to manage all changes to Azure SQL Database objects by using source control in GitHub. Every pull request submitted to production will be validated before it can be merged. Deployments must use the Release configuration. Security Requirements - Fabrikam identifies the following security requirements: • The TransactionProcessing application must use a passwordless connection to DB1. • The Employees table contains two columns named TaxID and Salary that must be encrypted at rest. • Auditors must have a tamper-evident history of transactions with cryptographic proof of changes to the employee data. Database Performance Requirements Records accessed by using sp_UpdateProcedureForPatient must NOT be changed by other transactions while the stored procedure runs. AI Search, Embeddings, and Vector Indexing Fabrikam identifies the following AI-related requirements: • Queries to the ProcedureDocuments table must use Reciprocal Rank Fusion (RRF). • Users must be able to query the data in DB1 by using prompts in Copilot in Microsoft Fabric. • The UsefulPrompts table will store prompts that doctors can use to help diagnose patient illness by connecting to an Azure OpenAI endpoint. Development Requirements - Fabrikam identifies the following development requirements: • Provide the functionality to retrieve all the transactions of a given patient between two dates, showing a running total. • Expose a Data API builder (DAB) configuration file to enable Azure services to perform the following operations over a REST API: o Read data from the procedures table without authentication. o Read and insert data into the Transactions table once authenticated. o Execute the sp_UpdateProcedurePatient stored procedure. • Provide the functionality to retrieve a list of the names of patients who underwent medical procedures during the last 30 days. • Information for each medical procedure will be stored in a table. The table will be used with a large language model (LLM) for user querying and will have the following structure. DAB - You create a DAB configuration file that meets the development requirements for DB1 and includes the following entities. You need to create a solution that meets the development requirements for retrieving the patient lists. How should you complete the Transact-SQL code? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point.
Explanation: Scenario: Fabrikam identifies the following development requirements: *-> Provide the functionality to retrieve a list of the names of patients who underwent medical procedures during the last 30 days.
Box 1: WHERE p.PatientId IN WHERE: Used to filter the rows returned by the main query. IN: Used to check if the PatientId exists within the list generated by the subquery.
Box 2: WHERE pr.PatientId = p.PatientId Correlated Subquery: Using WHERE pr.PatientId = p.PatientId links the subquery to the main query, ensuring the database only looks at procedures belonging to that specific patient.
Incorrect: * HAVING HAVING is used to filter groups after an GROUP BY clause is applied. Since your subquery does not use GROUP BY, HAVING would cause a syntax error.
Reference: https://medium.com/sql-explained/sql-basics-for-everyone-part-2-1638493175cd
Question 17
You have an Azure SQL database named ToDo that contains a table named dbo.ToDo. Your company plans to develop an Azure Functions app to run whenever the rows in dbo.ToDo change. The app will process INSERT, UPDATE, and DELETE events by using the Azure SQL trigger binding. You need to configure ToDo to support the planned app. What should you do?
- Enable change tracking on ToDo and dbo.ToDo.
- On dbo.ToDo, create a Data Manipulation Language (DML) trigger that calls the Azure Functions HTTP endpoint.
- Enable change data capture (CDC) on ToDo and dbo.ToDo.
- On dbo.ToDo, create a Data Definition Language (DDL) trigger that calls the Azure Functions HTTP endpoint.
Answer: A. Enable change tracking on ToDo and dbo.ToDo.
Explanation: To use the Azure SQL trigger for Azure Functions, your database table must have Change Tracking enabled. This is the underlying mechanism the trigger uses to monitor row-level modifications.
Required Table Configuration To facilitate the app, you must follow these three steps:
1. Enable Change Tracking on the Database Before the table can be tracked, the feature must be turned on at the database level.
2. Enable Change Tracking on the Table The specific table the Function monitors must have tracking enabled.
3. Define a Primary Key The Azure SQL trigger requires the table to have a Primary Key. The trigger uses the Primary Key to identify which specific rows were changed. If your table lacks a Primary Key, the Function will fail to start.
Reference: https://demiliani.com/2025/05/08/azure-function-sql-trigger-how-to-use-it-and-why-it-can-be-useful-in-your-business-central-projects/
Question 18
You have an Azure SQL database that contains a table named dbo.Customers. dbo. Customers contains the following columns: • CustomerId (int)(primary key) • ProfileJson (nvarchar(max)) You have an application that returns phone numbers in a format of +000 000-000-0000. The phone numbers are stored in ProfileJson. You need to write a query that returns: • One row per customer • A PhoneNUmerals column that contains only the digits How should you complete the Transact-SQL query? To answer, drag the appropriate values to the correct targets. Each value may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content. NOTE: Each correct selection is worth one point.
Explanation: To extract only the digits from a JSON property in T-SQL, you need to use JSON_VALUE to parse the string and TRANSLATE combined with REPLACE (or a similar pattern like REGEXP_REPLACE) to strip non-numeric characters.
Box 1: JSON_VALUE(c.ProfileJson, '$.phone') Extracting from JSON JSON_VALUE(c.ProfileJson, '$.phone') JSON_VALUE extracts a scalar value from a JSON string.
Box 2: REGEXP_REPLACE(p.PhoneRaw [^0-9]. ' ') In Transact-SQL (T-SQL), the REGEXP_REPLACE function can be used as a more powerful and concise alternative to the REPLACE(TRANSLATE(...)) pattern.
Box 3: p.PhoneRaw
Filter p.PhoneRaw This ensures that only customers who actually have a phone number in their JSON profile are included in the final set.
Reference: https://techgenies.com/what-data-type-would-a-phone-number-be-in-sql https://devblogs.microsoft.com/azure-sql/general-availability-announcement-regex-support-in-sql-server-2025-azure-sql/
Question 19
You have an Azure SQL database named SalesDB that supports an ecommerce application. SalesDB contains a table named dbo. Orders that has a clustered index on a column named OrderId. dbo. Orders receives continuous OLTP inserts and updates during business hours. Your analytics team runs hourly aggregate queries that scan dbo. Orders to calculate revenue trends for recent dates. You need to improve the performance of the hourly analytics queries without significantly affecting OLTP throughput. The solution must meet the following requirements: • Support near-real-time (NRT) analytics on the dbo. Orders table. • Reduce read time when retrieving analytical data from dbo.Orders. • Support indexing only rows that match a predicate, such as Active = 1. Which type of index should you use for each requirement? To answer, drag the appropriate index types to the correct requirements. Each index type may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content. NOTE: Each correct selection is worth one point.
Explanation: Box 1: a Nonclustered Columnstore Index on an existing rowstore table. Support near-real-time (NRT) analytics on the dbo.Orders table.
The best index for this scenario is a Nonclustered Columnstore Index (NCCI). This approach enables Hybrid Transactional and Analytical Processing (HTAP) by allowing you to run high-performance analytics directly on your OLTP table without moving data to a separate warehouse.
Why Nonclustered Columnstore is the Best Choice Optimized for Aggregates: It uses columnar storage to drastically speed up SUM, AVG, and COUNT operations.
Minimal OLTP Impact: Unlike a Clustered Columnstore, the table remains a B-tree (Clustered Index), keeping your singleton inserts and updates fast.
NRT Analytics: Since the index is on the same table, the data is updated automatically as transactions occur.
Compression: It significantly reduces the I/O needed for large table scans.
Box 2: A filtered Nonclustered Columnstore Index with a WHERE predicate Reduce read time when retrieving analytical data from dbo.Orders.
A Nonclustered Columnstore Index (NCCI) is the best choice for this scenario. This specific index type allows you to run high-performance analytics on an OLTP table without moving the data to a separate data warehouse.
To ensure the OLTP throughput remains high, consider the following configuration: Filtered Indexing: If your aggregate queries only look at "recent dates," create a Filtered Nonclustered Columnstore Index. This only indexes the latest data (e.g., WHERE OrderDate > '2024-01-01'), reducing the overhead on older rows.
Box 3: A filtered Nonclustered Columnstore Index with a WHERE predicate Support indexing only rows that match a predicate, such as Active = 1.
The best solution for your requirement is a Filtered Index. A filtered index is a nonclustered index that includes a WHERE clause. It allows you to index a specific subset of data, which minimizes the index size and reduces the overhead of maintaining the index during OLTP operations.
Why Filtered Indexes Fit Your Scenario Improved Query Performance: The SQL optimizer can target a much smaller subset of data (e.g., only Active = 1), leading to faster seeks and scans.
Reduced Maintenance Overhead: Unlike a full nonclustered index, a filtered index is only updated when a row meets the predicate or is changed to/from meeting the predicate.
Lower Storage Costs: Because it only stores a fraction of the table's rows, it consumes significantly less disk space and memory.
Statistics Accuracy: SQL Server maintains more accurate statistics for the specific data subset, leading to better execution plans for those aggregate queries.
Reference: https://learn.microsoft.com/en-us/sql/relational-databases/indexes/columnstore-indexes-design-guidance https://www.sqlshack.com/top-10-questions-answers-sql-server-indexes/
Question 20
You have an Azure SQL database that stores sales data and contains tables named Sales and Products. Sales contains three columns named SalesDate, ProductKey, and TotalSale, Sales is 10 TB and is loaded nightly by using a batch process. Most reporting queries scan large portions of Sales, filter on SalesDate or ProductKey, and use SUM() to aggregate TotalSale. Products is relatively small and is used primarily for point lookups and joins to Sales. You need to recommend which indexes to create to optimize the reporting queries. The solution must minimize storage requirements. Which type of index should you recommend for each table? To answer, drag the appropriate index types to the correct tables. Each index type may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content. NOTE: Each correct selection is worth one point.
Explanation: Box 1: A clustered columnstore index Sales
A Clustered Columnstore Index (CCI) is the best choice for this scenario. For a 10 TB table focused on large-scale analytical scanning and aggregation, columnstore technology offers the most efficiency.
Why Clustered Columnstore is the Winner Massive Compression: Columnstore indexes typically achieve 10x compression over raw data. This significantly reduces the 10 TB storage footprint.
Segment Elimination: The engine only reads the specific columns needed (e.g., TotalSale). It skips "segments" of data that don't match the SalesDate or ProductKey filters.
Batch Mode Processing: It uses a "batch mode" execution that processes rows in chunks rather than one by one, making SUM() operations extremely fast.
Optimized for Bulk Loads: Since your data loads via a nightly batch process, CCIs handle these high-volume inserts more efficiently than traditional B-tree indexes.
Box 2: A nonclustered rowstore index Products
For the Product table, you should create a Rowstore (B-tree) nonclustered index.
Why Rowstore for the Product Table? Optimized for Point Lookups: Rowstore indexes are specifically designed to find individual rows quickly based on a key (like ProductKey).
Small Table Efficiency: Columnstore indexes have high overhead (rowgroup metadata) that can actually increase the storage footprint of small tables.
Join Performance: Since reporting queries join the 15 TB Sales table to the Product table, a Rowstore index on the join key allows the SQL engine to perform efficient Index Seeks.
Minimal Storage: For a small table, a standard B-tree index uses negligible space compared to the compression structures required for Columnstore.
Reference: https://microsoft-bitools.blogspot.com/2017/11/ctas-fastest-way-to-load-data-on-mpp.html https://link.springer.com/chapter/10.1007/978-1-4842-8048-5_13