MySQL query to find number of employees under manager

In this tutorial I am going to show you how to find the number of employees under manager. Generally employees and managers both are employees of an organization. But according to the experience level seniority some employees in the organization become manager, lead, etc. Therefore the junior employees are going to report the senior employees. This example will show you how to find those senior employees, mainly managers, and how many junior employees are there under each manager.

Continue

Select only one random item from each category in MySQL

This tutorial shows how to select items randomly from each category in MySQL. So here I will select exactly one item randomly from each category. People who need sometimes to select photo from each photo category and display them on the page for animation purpose will be benefited. In this example I have used two sample tables with data. You can change the name and column names as per your needs and you will get the same results.

Continue