If actual performance exceeds the guaranteed minimum, payment should be calculated on the basis of that minimum. Yet, can I compare those two values, directly in my query? Sure! Check out examples below: In a nutshell, greatest() and least() make very neat SQL functions as they: can compare more than 2 values have the same … Continue reading How can I compare values with SQL?
Apart from the standard datediff() and timestampdiff(), Vertica and MySQL offer a couple of more ways to go about it: By using the age functions: age_in_years (current date, start date) and age_in_months (current date, start date) A key thing to remember about these two is that, unlike datediff ('years', start date, current date), they will calculate the months/years between the … Continue reading How do I find the difference between two time periods?
Being able to calculate the date of the coming Thursday may come really handy if your sales revenue follows a very strong weekday pattern as it enables you to use weekdays, rather than fixed dates, as a basis for making your weekly financial projections. How do I do this in practice? Vertica offers a very … Continue reading How do I find the next Monday/Tuesday/etc.. with SQL?