Posted by: Pdfprep
Post Date: November 20, 2020
You have a table named Table1 that contains 200 million rows. Table1 contains a column named SaleDate that has a data type of DateTime2(3).
Users report that the following query runs slowly.
You need to reduce the amount of time it takes to run the query.
What should you use to replace the WHERE statement?
A . WHERE SaleDate >= ‘2017-01-01’ AND SaleDate < ‘2018-01-01’
B . WHERE cast(SaleDate as varchar(10)) BETWEEN ‘2017-01-01’AND ‘2017-12-31’
C . WHERE cast(SaleDate as date) BETWEEN ‘2017-01-01’AND ‘2017-12-31’
D . WHERE 2017 = year(SaleDate)
Answer: C
Explanation:
References: https://docs.microsoft.com/en-us/sql/t-sql/queries/select-transact-sql?view=sql-server-2017
Leave a Reply