MySQL TIME_FORMAT()

In this tutorial, we will learn about the MySQL TIME_FORMAT() function. The time value in MySQL is of the format “HH:MM:SS” and in the 24 hour format. However, such a time value may be difficult to read for some people – who prefer the 12 hour format accompanied by AM/PM. Some people may not prefer …

MySQL TIME_FORMAT() Read More »

MySQL DATE_ADD() and DATE_SUB()

In this tutorial, we will study the MySQL DATE_ADD() and DATE_SUB() functions. DATE_ADD() and DATE_SUB() are a variation of the ADDDATE() and SUBDATE() functions. The main difference is that DATE_ADD() and DATE_SUB() only have one syntax each, not two syntaxes like ADDDATE() and SUBDATE(). The DATE_ADD() function is used to add a date or time …

MySQL DATE_ADD() and DATE_SUB() Read More »

MySQL EXTRACT()

In this tutorial, we will study the MySQL EXTRACT() function. The EXTRACT() function is a combination of the date functions and others like WEEK() and QUARTER(), and the time functions and others like MICROSECOND(). The EXTRACT() function is used to extract a part from a date or datetime value. This part can be day, month, …

MySQL EXTRACT() Read More »

MySQL GREATEST() and LEAST()

In this tutorial, we will study the MySQL GREATEST() and LEAST() functions. Suppose you have a ‘Triangles’ table that stores the length of the three sides of each triangle in three separate columns. You have been tasked to find the longest and the shortest side of each triangle. How do you do this? Normally, you …

MySQL GREATEST() and LEAST() Read More »