MySQL COALESCE() Function

In this tutorial, we will study the MySQL COALESCE() function. Suppose you have a table of contact details of a thousand people. The contact details can be a mobile number, a home number or a work phone. There is a column for each of these contact details. Note that not all contact detail columns are …

MySQL COALESCE() Function Read More »

MySQL DATE_FORMAT()

In this tutorial, we will learn about the MySQL DATE_FORMAT() function. The date value in MySQL is in the format “YYYY-MM-DD”. However, such a date value may be difficult to read for some people – who prefer it in some other format like DD/MM/YYYY or MM/DD/YYYY. Some people may prefer to see the day name …

MySQL DATE_FORMAT() Read More »

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 »