Jordan needs to optimize a query by reducing the total data set that is being processed. Which of the following accomplishes this?
Correct Answer: B. Subquery
A Subquery (also called a nested query) is a query inside another query that helps filter or limit the dataset being processed. By using a subquery, Jordan can retrieve only the necessary data, which reduces the total amount of records processed, thereby optimizing performance.
For example, if Jordan wants to retrieve customers who made purchases above the average order value, he could use a subquery:
sql
SELECT CustomerID, CustomerName
FROM Customers
WHERE CustomerID IN (
SELECT CustomerID
FROM Orders
WHERE OrderTotal > (SELECT AVG(OrderTotal) FROM Orders)
);
Here, the subquery calculates the average order total, reducing the data processed in the main query.
Why the other options are incorrect:
Query Execution Plan – Incorrect.
Estimated Execution Plan – Incorrect.
Actual Execution Plan – Incorrect.
No Payment Cards Needed
Discover a range of courses designed to provide you with the knowledge and skills needed to excel in your chosen field.
You don’t need one month to study and pass your test.
With Prepsaret, it takes you a few days to grasp all the concepts needed to pass your exams