The first query WHERE orderdate > currentdate - interval '7 days' selects all orders placed after exactly seven days ago. This means it includes orders from the last 6 full days plus any part of the current day that has passed.
The second query WHERE orderdate BETWEEN CURRENTDATE - INTERVAL '6 days' AND CURRENT_DATE selects orders where the orderdate falls within a specific range: from six days ago up to and including the current date. This effectively captures the last 7 days, including today.
The reason the second query passes the test cases is likely due to how the test cases are structured. They probably expect a precise inclusion of the current day's data up to the current moment, which the BETWEEN clause handles more explicitly by defining both the start and end boundaries of the period.