Database: employee_hire_evaluation

Question: Which cities do more than one employee under age 30 come from?
SQL: SELECT city FROM employee WHERE age  <  30 GROUP BY city HAVING count(*)  >  1

Question: Find the manager name and district of the shop whose number of products is the largest.
SQL: SELECT manager_name ,  district FROM shop ORDER BY number_products DESC LIMIT 1

Question: find the minimum and maximum number of products of all stores.
SQL: SELECT min(Number_products) ,  max(Number_products) FROM shop

Question: Find the names of stores whose number products is more than the average number of products.
SQL: SELECT name FROM shop WHERE number_products  >  (SELECT avg(number_products) FROM shop)

Question: find the name of employee who was awarded the most times in the evaluation.
SQL: SELECT t1.name FROM employee AS t1 JOIN evaluation AS t2 ON t1.Employee_ID  =  t2.Employee_ID GROUP BY t2.Employee_ID ORDER BY count(*) DESC LIMIT 1

Question: Find the name of the employee who got the highest one time bonus.
SQL: SELECT t1.name FROM employee AS t1 JOIN evaluation AS t2 ON t1.Employee_ID  =  t2.Employee_ID ORDER BY t2.bonus DESC LIMIT 1

Question: Find the names of employees who never won any award in the evaluation.
SQL: SELECT name FROM employee WHERE Employee_ID NOT IN (SELECT Employee_ID FROM evaluation)

Question: What is the name of the shop that is hiring the largest number of employees?
SQL: SELECT t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id  =  t2.shop_id GROUP BY t1.shop_id ORDER BY count(*) DESC LIMIT 1

Question: Find the name of the shops that do not hire any employee.
SQL: SELECT name FROM shop WHERE shop_id NOT IN (SELECT shop_id FROM hiring)

Question: Find the number of employees hired in each shop; show the shop name as well.
SQL: SELECT count(*) ,  t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id  =  t2.shop_id GROUP BY t2.name