Skip to main content

Posts

Showing posts from April, 2021

SQL Real Time Interview Questions with solutions

SQL_Query : In this MySQL challenge, your query should return the names of the people who are reported to (excluding null values), the number of members that report to them, and the average age of those members as an integer. The rows should be ordered by the names in alphabetical order. Your output should look like the  following table . Solution : SELECT  ReportsTo ,   count ( ReportsTo )   as  Members ,   round ( avg ( Age ),   0 )   as   'Average Age'     FROM  maintable_MS9H0 Where  ReportsTo  is   not   null Group   by  ReportsTo order   by  ReportsTo or SELECT  ReportsTo , COUNT ( FirstName )   as  Members , ROUND ( AVG ( Age ))   as   "Average Age"   FROM  maintable_MS9H0  WHERE  ReportsTo  IS   NOT   NULL   GROUP   BY  ReportsTo SQL_Query: In this MySQL challenge, the table provided shows all new users signing up on a specific date in the format YYYY-MM-DD. Your query should output the change from one month to the next. Because the f