Advertisement
aditya_pran

Project Task 12

Jan 20th, 2022
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. WITH
  2.  
  3. e AS   (SELECT  COUNT(DISTINCT(instituition)) AS No_of_instituitions,
  4.                 person_id
  5.         FROM education
  6.         GROUP BY person_id),
  7.        
  8. c AS   (SELECT  name,
  9.                 id
  10.         FROM company)
  11.        
  12. SELECT  c.name,
  13.         e.No_of_instituitions
  14. FROM people AS p
  15.     INNER JOIN e ON e.person_id = p.id
  16.     INNER JOIN c ON c.id = p.company_id
  17. ORDER BY e.No_of_instituitions DESC
  18. LIMIT 5;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement