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?
Need to provide a daily estimation of how many clicks you'll make by the end of next month? Your client expects you to deliver a monthly report on their performance? That's when knowing how to get the last day of the current, previous or next month might come in handy Whereas Vertica and MySQL offer … Continue reading How do I find the last day of the previous/next month with SQL?
Have you ever had to do weekly/monthly reporting based on SQL data retrieval? It would be pretty neat if you could get the start date of the current week/month dynamically, no? Well, there's a very straightforward way if you're using Vertica or PostgreSQL - just employ the date_trunc('period', timestamp) function. Other databases (e.g. SQL Server, MySQL) … Continue reading How do I find the first day of the current week with SQL?
Should you work for a public company, it is very likely that the fiscal year of your company may not be the same as the calendar year. This in turn, means, that a bunch of your analyses may need to forecast financials for the fiscal quarters, rather than the calendar ones. How could you then … Continue reading How do I calculate the remaining days until the end of a fiscal quarter?
Good question! As you'll see below, there are some different syntax options within the different database environments current_timestamp, though, will rarely disappoint Happy SQL-ing!