The Code Developer

MySQL SUM Function

Introduction to MySQL SUM Function This MySQL tutorial explains how to use the MySQL SUM function with syntax and examples. The MySQL SUM function returns the summed value of an expression. SUM() Syntax SELECT SUM(column_name) FROM table_name WHERE condition; To understand SUM function, consider an "OrderDetails" table, which is…
Read More...

MySQL MIN Function

Introduction to MySQL MIN Function This MySQL tutorial explains how to use the MIN function with syntax and examples. The MySQL MIN function returns the minimum value in a set of values. MIN() Syntax SELECT MIN(column_name) FROM table_name WHERE condition; To understand MIN function, consider an "books" table, which is having the…
Read More...

MySQL MAX Function

Introduction to MySQL MAX Function This MySQL tutorial explains how to use the MAX function with syntax and examples. The MySQL MAX function returns the maximum value in a set of values. MAX() Syntax SELECT MAX(column_name) FROM table_name WHERE condition; To understand MAX function, consider an "books" table, which is having the…
Read More...

MySQL HAVING Clause

Introduction to MySQL HAVING clause The MySQL HAVING clause is used in the SELECT statement to specify filter conditions for a group of rows or aggregates. The HAVING clause is used in combination with the GROUP BY clause to filter groups based on a specified condition. It always returns the rows where condition is TRUE. HAVING Clause…
Read More...

MySQL GROUP BY

Introduction to MYSQL GROUP BY clause The MYSQL GROUP BY Clause is used to collect data from multiple records and group the result by one or more column. The GROUP BY statement is often used with aggregate functions such as SUM, AVG, MAX, MIN and COUNT. It is generally used in a SELECT statement. GROUP BY Syntax SELECT column_name(s)…
Read More...

MySQL query to find the second highest salary

Write a MySQL query to find the second highest salary from the employees table. There are many ways to get second highest salary based upon which database you are using as different database provides different feature which can be used to find the second highest salary from the employees table. Consider an employees table, which is having the…
Read More...

MySQL COUNT() Function

MySQL COUNT function returns the number of records in a select query and allows you to count all rows in a table or rows that match a particular condition. MySQL COUNT function Syntax The syntax for the COUNT function in MySQL is: SELECT COUNT(aggregate_expression) FROM tables ; To understand MySQL COUNT function, consider an…
Read More...