Question
You have a SQL database in Microsoft Fabric that contains a table named WebSite.Logs. WebSite.Logs stores application telemetry data. WebSite.Logs contains a nvarchar(max) column named log that stores JSON documents.
You have a daily report that filters by the $.severity JSON property and returns LogId, LogDateTime, and log. The report frequently causes full table scans.
You need to modify WebSite.Logs to support efficient filtering by $.severity and avoid key lookups for the columns returned by the report.
How should you complete the Transact-SQL code to avoid full table scans? To answer, drag the appropriate values to the correct targets. Each value may be used once, more than once, or not at all.
```sql
ALTER TABLE WebSite.Logs
ADD severity [Target 1];
GO
CREATE INDEX ix_severity
ON WebSite.Logs(severity)
[Target 2];
GO
```
NOTE: Each correct selection is worth one point.
Explanation
JSON_VALUE extracts a scalar value, so a computed column built on it can be indexed and lets the engine seek on severity instead of scanning the table. JSON_QUERY is for objects and arrays and returns NULL for a scalar such as severity. To avoid key lookups, the index must cover every column the report returns, so INCLUDE (LogId, LogDateTime, [log]) is needed. INCLUDE (log) alone leaves LogId and LogDateTime to be fetched from the table.