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
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 the id and name of the employee with maximum salary.
assistant
SELECT eid , name FROM Employee ORDER BY salary DESC LIMIT 1
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
How many employees have salary between 100000 and 200000?
assistant
SELECT count(*) FROM Employee WHERE salary BETWEEN 100000 AND 200000
human
What is the average and largest salary of all employees?
assistant
SELECT avg ( salary ) , MAX( salary ) FROM Employee ;