June 2025 Discount: Comprehensive Database Performance Health Check | Testimonials

Home
  • Consulting
  • Training
  • Free Videos
  • All Articles
    • Interview Questions and Answers
    • SQL Tips and Tricks
    • SQL Performance
    • SQL Puzzle
    • Big Data
    • Blog Stats
    • SQL Books
    • Search SQLAuthority
  • Downloads
  • Hire Me
  • Health Check

SQL SERVER – List the Name of the Months Between Date Ranges

December 9, 2014
Pinal Dave
SQL, SQL Server, SQL Tips and Tricks
SQL DateTime
Here is another interesting question, I received the other day. “How to list the name of the months between two date ranges?” Very interesting question. I had no script ready for it so I asked my friend who used to my co-worker earlier and he has sent me the script…
Read More

SQL SERVER – Finding if Current Week is Odd or Even – Script

December 7, 2014
Pinal Dave
SQL, SQL Server, SQL Tips and Tricks
SQL DateTime
Here is an interesting question I received from my friend who is working in Bank as a DBA. “Pinal, We have a requirement in bank that every 2nd and 4th week we keep more cash in our bank where as we can keep less cash on other weeks. I want…
Read More

SQL SERVER – Convert Seconds to Hour : Minute : Seconds Format

August 17, 2014
Pinal Dave
SQL, SQL Server, SQL Tips and Tricks
SQL DateTime
Here is another question I received via email. “Hi Pinal, I have a unique requirement. We measure time spent on any webpage in measure of seconds. I recently have to build a report over it and I did few summations based on group of web pages. Now my manager wants…
Read More

SQL SERVER – Validating If Date is Last Day of the Year, Month or Day

August 15, 2014
Pinal Dave
SQL, SQL Server, SQL Tips and Tricks
SQL DateTime
Here is one more question I recently received in an email- “Pinal, is there any ready made function which will display if the given date is the last day or the year, month or day? For example, if a date is the last day of the Year and last day…
Read More

SQL SERVER – Script to Find First Day of Current Month

August 14, 2014
Pinal Dave
SQL, SQL Server, SQL Tips and Tricks
SQL DateTime, SQL Function
Earlier I wrote a blog post about SQL SERVER – Query to Find First and Last Day of Current Month and it is a very popular post. In this post, I convert the datetime to Varchar and later on use it. However, SQL Expert Michael Usov has made a good…
Read More

MySQL – How to Format Date in MySQL with DATE_FORMAT()

July 19, 2014
Pinal Dave
SQL, SQL Tips and Tricks
MySQL, SQL DateTime
MySQL supports formatting the datetime values into a different formats using DATE_FORMAT() function. This function accepts date/datetime values as a first parameter and returns into a specific format defined as a second parameter. Let us explore this with the following examples which are self-explanatory Define a DATETIME variable SET @date:='2014-06-16…
Read More

MySQL – Finding First day and Last day of a Month

April 9, 2014
Pinal Dave
SQL, SQL Tips and Tricks
MySQL, SQL DateTime
MySQL supports a lot of DATE and TIME related functions. If you want to find out last day of a month, you can make use of an inbuilt function named LAST_DAY. SET @date:='2012-07-11'; SELECT LAST_DAY(@date) AS last_day; The above code returns the value 2012-07-31 However, there is no inbuilt function…
Read More
Previous 1 … 7 8 9 10 11 12 13 … 19 Next
  • SQL Interview Q & A
  • Testimonials
  • Search
  • Privacy Policy

© 2006 – 2025 All rights reserved. pinal @ SQLAuthority.com

Go to mobile version