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
What is average and maximum salary of all employees.
assistant
SELECT avg(salary) , max(salary) FROM Employee
human
Show ids for all employees with at least 100000 salary.
assistant
SELECT eid FROM Employee WHERE salary > 100000
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 the name of employees with three lowest salaries.
assistant
SELECT name FROM Employee ORDER BY salary ASC LIMIT 3
human
Show name and salary for all employees sorted by salary.
assistant
SELECT name , salary FROM Employee ORDER BY salary
human
Show names for all employees with salary more than the average.
assistant
SELECT name FROM Employee WHERE salary > ( SELECT avg ( salary ) FROM Employee ) ;