-- Database schema
| Categories : CategoryID [ INTEGER ] primary_key , CategoryName [ TEXT ] , Description [ TEXT ] | Customers : CustomerID [ INTEGER ] primary_key , CustomerName [ TEXT ] , ContactName [ TEXT ] , Address [ TEXT ] , City [ TEXT ] , PostalCode [ TEXT ] , Country [ TEXT ] | Employees : EmployeeID [ INTEGER ] primary_key , LastName [ TEXT ] , FirstName [ TEXT ] , BirthDate [ DATE ] , Photo [ TEXT ] , Notes [ TEXT ] | Shippers : ShipperID [ INTEGER ] primary_key , ShipperName [ TEXT ] , Phone [ TEXT ] | Suppliers : SupplierID [ INTEGER ] primary_key , SupplierName [ TEXT ] , ContactName [ TEXT ] , Address [ TEXT ] , City [ TEXT ] , PostalCode [ TEXT ] , Country [ TEXT ] , Phone [ TEXT ] | Products : ProductID [ INTEGER ] primary_key , ProductName [ TEXT ] , SupplierID [ INTEGER ] Products.SupplierID = Suppliers.SupplierID , CategoryID [ INTEGER ] Products.CategoryID = Categories.CategoryID , Unit [ TEXT ] , Price [ REAL ] | Orders : OrderID [ INTEGER ] primary_key , CustomerID [ INTEGER ] Orders.CustomerID = Customers.CustomerID , EmployeeID [ INTEGER ] Orders.EmployeeID = Employees.EmployeeID , OrderDate [ DATETIME ] , ShipperID [ INTEGER ] Orders.ShipperID = Shippers.ShipperID | OrderDetails : OrderDetailID [ INTEGER ] primary_key , OrderID [ INTEGER ] OrderDetails.OrderID = Orders.OrderID , ProductID [ INTEGER ] OrderDetails.ProductID = Products.ProductID , Quantity [ INTEGER ] |
-- -- What is the difference in salary of the top 2 employees with the highest number of territories in charge?

SELECT MAX(Salary) - MIN(Salary) FROM ( SELECT T1.Salary FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID GROUP BY T1.EmployeeID, T1.Salary ORDER BY COUNT(T2.TerritoryID) DESC LIMIT 2 ) T1;