
Ultimate access to all questions.
Imagine you are working with a lakehouse in Fabric that contains a table named 'Transactions' with columns 'TransactionID', 'ProductID', 'CustomerID', 'TransactionDate', and 'Amount'. You need to write a SQL query to find the total amount of transactions for each product in the last month. How would you structure this query?
A
SELECT ProductID, SUM(Amount) AS TotalAmount FROM Transactions WHERE TransactionDate >= DATEADD(month, -1, GETDATE()) GROUP BY ProductID;
B
SELECT ProductID, SUM(Amount) AS TotalAmount FROM Transactions GROUP BY ProductID;
C
SELECT ProductID, Amount AS TotalAmount FROM Transactions WHERE TransactionDate >= DATEADD(month, -1, GETDATE());
D
SELECT ProductID, Amount AS TotalAmount FROM Transactions;