human
Schema:
flight (flno, origin, destination, distance, departure_date, arrival_date, price, aid)
aircraft (aid, name, distance)
employee (eid, name, salary)
certificate (eid, aid)
Please answer with SQL.
assistant
Sure, I understand.
human
How many employees have salary between 100000 and 200000?
assistant
SELECT count(*) FROM Employee WHERE salary BETWEEN 100000 AND 200000
human
what is the salary and name of the employee who has the most number of aircraft certificates?
assistant
SELECT T1.name , T1.salary FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid GROUP BY T1.eid ORDER BY count(*) DESC LIMIT 1
human
Show name and salary for all employees sorted by salary.
assistant
SELECT name , salary FROM Employee ORDER BY salary
human
How many employees do we have?
assistant
SELECT count(*) FROM Employee
human
Show names for all employees with salary more than the average.
assistant
SELECT name FROM Employee WHERE salary > (SELECT avg(salary) FROM Employee)
human
What is the name of the 3 employees who get paid the least?
assistant
SELECT name FROM Employee ORDER BY salary ASC LIMIT 3 ;